Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Node app in Docker container with aws-sdk

Background I have a node app that essentially needs to use aws-sdk to access S3 bucket and perform other operations. In my local machine I have a .aws config file that sits in ~/.aws/config. I want to run this node app in a docker container (so that I can deploy it to EC2 later).

The problem How do I configure my docker container to use the aws config file so that the node app running in it can use aws-sdk?

Clarification I do not want to use IAM. I specifically want to use aws config file which has the secret access key etc.

like image 657
P.B.UDAY Avatar asked Jun 12 '26 04:06

P.B.UDAY


1 Answers

You can do what AWS is doing when they explain how to use their containers on local machines. For example, for local AWS Glue they simply share the ~/.aws/ with the docker container using:

-v ~/.aws:/root/.aws:ro

Obviously you would have to adjust the paths above to match your local and docker setup.

The other way is to pass the AWS credentials using docker environment variables.

like image 141
Marcin Avatar answered Jun 14 '26 19:06

Marcin