[英]How to access other AWS services from inside a AWS ECS container on a EC2 host?
From AWS documentations, a program running in AWS EC2 instance created with the correct IAM role could use AWS SDK to get temporary aws_access_key_id
and aws_secret_access_key
for accessing desired aws resources. 在AWS文档中,使用正确的IAM角色创建的AWS EC2实例中运行的程序可以使用AWS SDK获取临时aws_access_key_id
和aws_secret_access_key
以访问所需的aws资源。 Does that apply for programs running inside a docker container in that instance? 这适用于在该实例中在docker容器内运行的程序吗? In my case, the container is started via AWS ECS and the program inside the container needs to access s3. 在我的例子中,容器是通过AWS ECS启动的,容器内的程序需要访问s3。
If that is not general practice, what is the proper way of accessing a file stored in s3 from inside a container? 如果这不是一般做法,那么从容器内部访问存储在s3中的文件的正确方法是什么?
Yes, Program running inside ECS can access s3 similarly to a program running inside Ec2 server. 是的,在ECS内运行的程序可以访问s3,类似于在Ec2服务器内运行的程序。 You need to set up proper IAM roles while launching ECS. 您需要在启动ECS时设置适当的IAM角色。
See this link Amazon ECS IAM Role guide for developers 请参阅此链接Amazon ECS IAM开发人员角色指南
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.