I'm just started on using aws-sdk-go and notice that the s3 requests are using http/https rather than s3 protocol. How can I read the object in s3 from my lambda within vpc using aws-sdk-go?
And I don't want to use NAT Gateway. I can do this in NodeJS but is there any way for aws-go-sdk to do the same?
Thanks!
To access S3 within a VPC without an internet gateway you need to use a S3 Endpoint
This code snippet shows how to use aws-go-sdk to list S3 buckets for region us-east-1 within a Lambda function:
func listBuckets() {
svc := s3.New(session.New(&aws.Config{Region: aws.String("us-east-1")}))
buckets, err := svc.ListBuckets(nil)
log.Printf("listBuckets: %q error=%v", buckets, err)
}
Find full source code here: https://github.com/udhos/hellolambda/blob/master/main.go