Search code examples
amazon-web-servicesamazon-ec2amazon-iamassume-role

How to make an EC2 instance, which can not access internet, access resource in the same account?


I search for a solution is Using credentials for Amazon EC2 instance metadata. I use an EC2 instance in public subnet, and it success.

But my EC2 instance is in Private Subnet and cannot access the Internet. By using IAM service role for EC2, my account cannot access the resource in the same account. I don't know what is the problem and how to solve it.

Thanks in advance!


Solution

  • The answer is easy. Just add the VPC endpoint of the service you want to use.