Accessing AWS S3 from applications
AWS S3 is highly scalable and durable object storage. You only have to pay for the storage you actually use. S3 replicates data in multiple data centers within the region. Further, AWS S3 introduces cross-region replication that replicates your data across AWS regions. In this recipe, we cover both uploading objects to and downloading objects from AWS S3.
How to do it…
Installing AWS Java SDK.
In your Maven dependency section, add the following dependency for AWS Java SDK Version 1.9.28.1:
<dependency> <groupId>com.amazonaws</groupId> <artifactId>aws-java-sdk</artifactId> <version>1.9.28.1</version> </dependency>
Create a bucket.
The following sample Java program creates a S3 bucket called
laurenceluckinbill
in the Singapore region:// Create S3 bucket. public static void CreateBucket() { // Create BasicAWSCredentials with Access Key Id and Secret Access Key. BasicAWSCredentials...