Last active
August 29, 2015 14:03
-
-
Save marlhammer/db985c52b6ba8e7057ce to your computer and use it in GitHub Desktop.
Aws Example (S3)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider; | |
import com.amazonaws.regions.Region; | |
import com.amazonaws.regions.Regions; | |
import com.amazonaws.services.s3.AmazonS3; | |
import com.amazonaws.services.s3.AmazonS3Client; | |
import com.amazonaws.services.s3.model.Bucket; | |
import com.amazonaws.services.s3.model.PutObjectRequest; | |
public class AwsExampleS3 { | |
public static void main(String[] args) throws Exception { | |
AmazonS3Client s3Client = new AmazonS3Client(new ClasspathPropertiesFileCredentialsProvider()); | |
s3Client.setRegion(Region.getRegion(Regions.US_EAST_1)); | |
PutObjectRequest putObjectRequest = new PutObjectRequest( | |
"smouring-test-bucket", // Bucket Name | |
"s3Java.txt", // Object Name | |
new File("s3Java.txt") // File | |
); | |
s3Client.putObject(putObjectRequest); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment