| Did this page help you? Yes No Tell us about it... |
The following tasks guide you through using the Java classes to send authenticated requests using your AWS Account credentials or IAM user credentials.
Making Requests Using Your AWS Account or IAM user Credentials
|
1 |
Create an instance of the |
|
2 |
Execute one of the |
The following Java code sample demonstrates the preceding tasks.
AWSCredentials myCredentials = new BasicAWSCredentials(
myAccessKeyID, mySecretKey);
AmazonS3 s3client = new AmazonS3Client(myCredentials);
// Send sample request (list objects in a given bucket).
ObjectListing objectListing = s3client.listObjects(new
ListObjectsRequest().withBucketName(bucketName));
![]() | Note |
|---|---|
You can create the AmazonS3Client client without providing your security credentials. Requests sent using this client are anonymous requests, without a signature. Amazon S3 returns an error if you send anonymous requests for a resource that is not publicly available. |
For working examples, see Working with Amazon S3 Objects and Working with Amazon S3 Buckets. You can test these examples using your AWS Account or IAM user credentials.
For example, to list all the object keys in your bucket, see Listing Keys Using the AWS SDK for Java.