How to upload files into the AWS S3 bucket using java
HOW TO UPLOAD FILES INTO AWS S3 BUCKET USING JAVA
- First, create the object of AWSCredentials and pass the aws_access_key_id and aws_secret_access_key as parameters.
- Next, create the s3client object for connecting to the aws s3 bucket.
- For creating a connection we can pass the AWSCredentials object as a parameter.
- Using the createBucket method so we can create the bucket.
- Using the putObject method to upload the file into the aws s3 bucket.
import com.amazonaws.ClientConfiguration;
import java.io.File;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.PutObjectRequest;
/**
*
* @author Janardhan Randhi
* Date : Feb 4 2019
* Description : This class upload the file into AWS S3 storage blob.
*
*/
public class AWSFileUpload {
//private static final String SUFFIX = "/";
public static void main(String args[])
{
AWSCredentials credentials = new BasicAWSCredentials(
"*********Key",
"**********pwd");
// create a client connection based on credentials
AmazonS3 s3client = new AmazonS3Client(credentials,cc);
// create bucket - name must be unique for all S3 users also small letter required
String bucketName = "janardhan";
s3client.createBucket(bucketName);
// create folder into bucket
//String folderName = ""; here i am not taking any key(folder),if you want to create you can pass the key in put object method.
long startTime = System.currentTimeMillis();
String fileName = file.getName();;
s3client.putObject(new PutObjectRequest(bucketName, fileName, file));
System.out.println("file uploaded sucessfully to " + bucketName);
long endTime = System.currentTimeMillis();
new File( file.getName()).delete(); //Delete the file from local system folder.
System.out.println("Time taken to upload a single file : " + (endTime - startTime) + " milliseconds");
}
}
As we probably am aware, mp4 is a configuration that playable on macintosh, so on the off chance that you need to watch swf document on macintosh you can change over swf to mp4 macintosh.www.anyconv.com
ReplyDeleteWonderful blog...! This information is very helpful for enhancing my knowledge and Thank you...!
ReplyDeleteOracle DBA Training in Chennai
best oracle dba training in chennai
Spark Training in Chennai
Oracle Training in Chennai
Graphic Design Courses in Chennai
Excel Training in Chennai
Unix Shell Scripting Training in Chennai
Placement Training in Chennai
Soft Skills Training in Chennai
JMeter Training in Chennai
Tableau Training in Chennai
Email suppliers work with the point of offering quick messaging serving, and file stockpiling isn't their essential undertaking. transfer large files
ReplyDeleteAwesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! file storage
ReplyDeleteYour work is very good and I appreciate you and hopping for some more informative posts. Thank you for sharing great information to us. Scum buckets
ReplyDeletePlease add code for file upload using folder passing key. Above code references file which I didn't see the object creation.
ReplyDeleteEskişehir
ReplyDeleteDenizli
Malatya
Diyarbakır
Kocaeli
VDNOLT
Diyarbakır
ReplyDeleteKırklareli
Kastamonu
Siirt
Diyarbakır
LMH3
Kocaeli
ReplyDeleteDenizli
Bursa
istanbul
Van
ML6ZM
van
ReplyDeletezonguldak
yalova
urfa
gümüşhane
UY0VS
bartın evden eve nakliyat
ReplyDeleteedirne evden eve nakliyat
mersin evden eve nakliyat
sinop evden eve nakliyat
siirt evden eve nakliyat
F4JPİ3
53C4F
ReplyDeleteAnkara Sohbet Sitesi
şırnak parasız görüntülü sohbet uygulamaları
istanbul bedava sohbet chat odaları
bitlis rastgele görüntülü sohbet uygulamaları
igdir sesli sohbet mobil
görüntülü sohbet ücretsiz
ucretsiz sohbet
kırıkkale mobil sohbet siteleri
denizli rastgele sohbet uygulaması
4D53E
ReplyDeletekraken
yulaf bal sabunu
btcturk
paribu
bitexen
aax
bitcoin nasıl oynanır
https://toptansatinal.com/
btcturk
ADDD6
ReplyDeletebitcoin ne zaman çıktı
kucoin
bitexen
4g mobil
bkex
bitcoin nasıl oynanır
https://kapinagelsin.com.tr/
kizlarla canli sohbet
papaya meyvesi
BB546
ReplyDeletefiltre kağıdı
sohbet canlı
bitcoin haram mı
bingx
kucoin
poloniex
paribu
telegram en iyi kripto grupları
rastgele canlı sohbet
9D174
ReplyDeletetelegram en iyi kripto grupları
en eski kripto borsası
copy trade nedir
okex
telegram kripto para grupları
en az komisyon alan kripto borsası
bitcoin hesabı nasıl açılır
aax
huobi
2D410
ReplyDeletegüvenilir ücretli şov
91E323733F
ReplyDeleteviga
cobra vega
canli web cam show
themra macun
ücretli şov
whatsapp görüntülü show güvenilir
performans arttırıcı
novagra
cam show
297080D559
ReplyDeletegeciktirici
bufalo çikolata
cobra vega
lifta
fx15
whatsapp görüntülü şov
performans arttırıcı
kamagra
viga
FAE27EA8B5
ReplyDeletecanli cam show
lifta
telegram görüntülü şov
performans arttırıcı
themra macun
cialis
canli web cam show
degra 100 mg
telegram show
E7AC6B1D86
ReplyDeletesildegra
telegram görüntülü şov
canli web cam show
stag
cobra vega
sinegra 100 mg
görüntülü şov
cam şov
whatsapp görüntülü şov