P.B.UDAY
P.B.UDAY

Reputation: 483

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.

Upvotes: 3

Views: 1265

Answers (1)

Marcin
Marcin

Reputation: 238647

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.

Upvotes: 5

Related Questions