Copying a file in S3 o ECS Container

0

How do we copy the file in S3 bucket to a particular location inECS Container ? (eg:/usr/local/tomcat/webapps/root/js). I am downloading the image from ECR and creating a container out of it. But I need to copy the custom config-local.js to a particular location in ECS. I am trying to do it via environment command. But it throwing errors. Please help me as I could not find much information for the same in documentation .

2개 답변
0

Have you tried using volumes as mentioned under the Volumes section of this document from docker - https://docs.docker.com/cloud/ecs-integration/

Also look at this - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/efs-volumes.html

profile pictureAWS
전문가
답변함 2년 전
  • I have tried adding my file to be copied into a folder in efs and I was able to attach it to a container.But that is not what I am looking for. I want to copy a particular file onto a specific destination inside the container(/usr/local/tomcat/webapps/root/js). Copying to efs and attaching the volume did not solve my problem.Appreciate your response. Thanks in advance!!

0

Hello there.

I would recommend having a docker volume that you can declare very easily if you use docker-compose and have a sidecar that will deal with downloading/creating configuration files for you in this/these docker volume(s). Especially if you do not need the files to be shared across different containers, which would require you to use NFS/AWS EFS.

I have written a sidecar container that can do all of this for you, which you can get from here

I have numerous examples of using it that can be found in labs (GitHub)

The "instructions" on files to download / generate files using it in the docs as well. The configuration itself can be stored in either of these. I usually like to store it base64 encoded in SSM, but if the file gets too large, you can use S3 instead.

To simplify the deployment of your service with these two, I'd recommend using ECS Compose-X which will take care of your volumes configuration, IAM permissions, and access to S3, etc.

This might be one of the simplest examples I have to demonstrate both.

Hope this helps.

profile picture
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠