Search code examples
amazon-web-servicesamazon-s3amazon-ecs

AWS ECS upload file to bucket from within container via bash


I have a ecs task running with aws fargate. I generate some files on the container and need to upload these files to an s3 bucket.

Can I do this by installing the aws cli to the container?

I'm not sure about the following stuff:

  • Do I need to use some rest api (like python boto3 library) or can I use the aws console?
  • How should I authenticate the requests (iam and aws secrets manager?)

Solution

  • Do I need to use some rest api (like python boto3 library) or can I use the aws console?

    Are you asking how to install the AWS CLI into the Docker container running in ECS? You would need to update your Docker image to include the AWS CLI and then redeploy the container to ECS. The AWS API, Boto3, or the AWS console are not going to help with that task.

    How should I authenticate the requests (iam and aws secrets manager?)

    By assigning an IAM role to the ECS task.