简体   繁体   English

如何从EC2主机上的AWS ECS容器内访问其他AWS服务?

[英]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_idaws_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.

相关问题 如何让 AWS ECS 自动将我的容器的端口映射到主机(EC2) - How to have AWS ECS automatically map ports of my container to the host machine(EC2) AWS ECS - 无法从同一子网上的 ECS 容器实例连接到 RabbitMQ EC2 实例 - AWS ECS - Can't connect to RabbitMQ EC2 instance from ECS container instance on the same subnet 在AWS ec2主机上访问Django应用 - Access Django App on AWS ec2 host AWS Elastic Beanstalk与EC2容器服务(ECS) - Docker - AWS Elastic Beanstalk Vs EC2 Container Service (ECS) - Docker AWS EC2 ECS 在您的集群中未找到任何容器实例 - AWS EC2 ECS No Container Instances were found in your cluster AWS ECS如何将服务从一个容器调用到另一个容器 - AWS ECS how to call services from one container to another one 如何在 Angular 应用程序中访问 ECS 容器内的 AWS .env 变量? - How to access AWS .env variables inside the ECS container in an angular app? 如何为在 EC2 模式下在 AWS ECS 集群中运行的容器分配公共 IP - How to assign a public IP to container running in AWS ECS cluster in EC2 mode 无法从在 AWS ECS 中运行的 springboot 应用程序访问在 EC2 上运行的 elasticsearch - Can't access elasticsearch running on EC2 from a springboot application running in AWS ECS 如何停止运行AWS EC2容器服务(Fargate) - How to stop AWS EC2 Container Service (Fargate) from running
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM