question

Nitu Gupta avatar image
Nitu Gupta asked

uploading a file in S3 bucket using the VPC endpoint URL

I am trying to load a file in S3 bucket using VPC endpoint. I can upload the file using this code:

 TransferUtility utility = new TransferUtility(awsAccessKey, awsSecretKey, Amazon.RegionEndpoint.USWest1);
            TransferUtilityUploadRequest request = new TransferUtilityUploadRequest();
            request.BucketName = "test" + @"/" + S3Path;
            request.InputStream = st;
            
            utility.Upload(request); 

I was asked to use the VPC endpoint to get the S3 client and then upload the bucket. After Google searching, I could find this code in java

String endpoint = Toolkit.getParameter("s3-vpc-endpoint");
        S3Client s3Client = S3Client.builder().region(Region.US_WEST_2)
                .endpointOverride(URI.create(endpoint))
                .build();

I couldn't figure out how to get the S3Client using VPCEndpointdo in C#.

any help will be greatly appreciated.

aws
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers