This example is based on NodeJs 10.
In the following example you gonna need the following env vars defined:
- APP_NAME: the application name.
- AWS_REGION: region where the parameters has been stored
$ npm install
$ docker build \
-t ${APP_NAME} \
--build-arg "AWS_REGION=${AWS_REGION}" \
--build-arg "APP_NAME=${APP_NAME}" \
.
- Running on
ECS
: Attach an IAM Role to the Task - Running inside
EC2
: Attach an IAM Role to the instance - Running locally: you might have to either:
- define the AWS ENV Vars manually in the docker build command line
- create a valid
credentials
file and copy it to/root/.aws/credentials
inside your image