Search code examples
amazon-web-servicesdockerdockerfilenodes

How to add aws-cli v2 in production?


I have developed an application in nodejs/vuejs and I want to dockerize the whole project before push it in production.

Knowing that my API is executing an aws command at a specific time, I need to install and configure AWS-CLIv2 in production.

crontab.scheduleJob('30 8,12 * * *', () => {  
  shelljs.exec("rm -rf src/data/*.csv && aws s3 cp s3://${bucketName}/`aws s3 ls s3://${bucketName} | tail -n 1 | awk '{print $4}'` src/data");
});

For development, I installed (from line command) and configured AWS locally from https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html

Would it be possible to install aws-cliv2 via the API's Dockerfile? What structure should I adopt?

Otherwise offer me your solutions please ?

Thank you


Solution

  • Maybe you can try use the SDK of AWS for interact with the AWS API (in this case the S3 Bucket), but if you prefer use the aws-cli binary you can install the binary like this docker image is made it or make your docker image based in this image.