July 26, 2020
I spent too much time Saturday getting the Go S3 SDK to work with LocalStack.. It turns out that if you are using LocalStack, you need to explicitly configure the following properties:
sess, err := session.NewSession(aws.NewConfig(). WithEndpoint(endpoint). WithRegion(region). WithS3ForcePathStyle(true)) The requirements for Endpoint and Region are obvious. If S3ForcePathStyle is not specified, then LocalStack will fail.
data, err := svc.GetObject(&s3.GetObjectInput{ Bucket: &bucket, Key: &cfgKey, }) What is path-style? In May 2019, Amazon deprecated path-based access model for S3 objects.
read more