aws.s3 icon indicating copy to clipboard operation
aws.s3 copied to clipboard

Connecting to localstack

Open rabalasubramani3 opened this issue 1 year ago • 1 comments

Has anyone successfully connect to localstack with this package. I tried setting endpoint_url

Sys.setenv( "AWS_ACCESS_KEY_ID"="foo", "AWS_SECRET_ACCESS_KEY"="bar", "AWS_DEFAULT_REGION"="us-east-1", "AWS_S3_ENDPOINT"="http://localhost:4566" )

and calling bucketlist()

will return an error like this.

500 Could not resolve host: us-east-1.http

Tried various combinations for AWS_S3_ENDPOINT like

localhost:4566 localstack:4566 host.docker.internal:4566 localhost.localstack.cloud:4566

None of them seem to work.

Any help appreicated.

rabalasubramani3 avatar Feb 11 '24 16:02 rabalasubramani3

Hello, I have same problem and I found how to do that :

In environment variables you have to modify your AWS_S3_ENDPOINT to localhost:4566.

After that you have to modify default region in aws.s3 config to set it empty (it does not works with env variable at first test). You have normally that and it will be works :

Sys.setenv(
"AWS_ACCESS_KEY_ID"="foo",
"AWS_SECRET_ACCESS_KEY"="bar",
"AWS_S3_ENDPOINT"="localhost:4566"
)
options("cloudyr.aws.default_region" = "")

And, important part, on all libary call, you have to pass option use_https = FALSE :

useHttps <- FALSE
get_object(fileKey, bucket = bucket, use_https = useHttps)

I hope it will help you ;)

throrin19 avatar Nov 05 '24 09:11 throrin19

This is actually discussed explicitly in the documentation - see the comments for the base_url argument.

s-u avatar Aug 18 '25 02:08 s-u