Home > Net >  AWS S3 access through VPC endpoint and ALB
AWS S3 access through VPC endpoint and ALB

Time:09-27

I have created a bucket in S3. I want to retrieve the documents using Java SDK from my local machine, not from EC2. In order to access the local machine, I have created the VPC interface endpoint for S3 and ALB which routes to the VPC endpoint.

local machine -> ALB -> VPC endpoint -> S3

I have added the ALB IP for the VPC endpoint DNS name along with the bucket name in the /etc/hosts. The reason is, the S3 SDK endpoint URL will be [bucketname].[endpoint DNS name]

AmazonS3ClientBuilder.standard().withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(ENPOINT_URL, "eu-west-1")).withCredentials(awsCred).build();

upon executing above piece of code, I get

com.amazonaws.services.s3.model.AmazonS3Exception: The specified bucket does not exist (Service: Amazon S3; Status Code: 404; Error Code: NoSuchBucket; Request ID: M6ECW14CH0CK6SNK; S3 Extended Request ID: zlgF4fvV KgebQUS7sIz3iyXtIlCf kaXPJQqE3QRK aTETMpRu/bsHkhlbXgs=; Proxy: null), S3 Extended Request ID: zlgF4fvV KgebQUS7sIz3iyXtIlCf kaXPJQqE3QRK aTETMpRu/bsHkhlbXgs=

Could someone say what am missing here?

Note: S3 shall be invoked directly without this approach but this is for POC purposes.

CodePudding user response:

It works after updating the SDK version to 2.17.281 (latest as of now).

  • Related