I've amazon aws s3 endpoint, access key and secret key, i want to validate my endpoint using these key in java, can someone help how to test my endpoint if you can share some sample code will be very helpful.
Thanks
I tried the below code but its not authenticating:
public class AmazonS3Example
{
private static final String SUFFIX = "/";
public static void main(String[] args)
{
AWSCredentials credentials = new BasicAWSCredentials(
"YourAccessKeyID",
"YourSecretAccessKey");
AmazonS3 s3client = new AmazonS3Client(credentials);
s3client.setEndpoint("http://someendpoing.com");
}
}
An endpoint is an Amazon supplied value.
http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html
E.g. s3.amazonaws.com for US Standard.
Or s3-<region>.amazonaws.com, E.g. s3-eu-west-1.amazonaws.com
You are using an incorrect endpoint. Plus in most situations you want to set the Amazon Region, not the endpoint specifically. See http://docs.aws.amazon.com/AmazonS3/latest/dev/create-bucket-get-location-example.html for an example.
With your Account credentials, Region and Bucket name, Amazon S3 API has all it needs to find your files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With