简体   繁体   中英

Can a docker container get access to (not local) DynamoDB?

I am learning about microservices and Docker and I have made a small application in visual studio 2022 that basically can perform CRUD operations on the DynamoDB (with ASP.NET 6.0). When I run the project on localhost everything works, but as soon as I make a docker container and try to perform crud from the Docker container, I get an error that states:

unable to get iam security credentials from ec2 instance metadata service

I tried a bunch of things like changing my appsettings.json, but came to the conclusion that that is not the problem since it works when I run the solution locally.

When I google about this problem I get overflow with information about running DynamoDB locally. I get that that is good for developing purpose, but I still want to try to perform CRUD operations on my DynamoDB from the Docker container (and think it must be possible).

So my question is: is it possible to access my DynamoDB table from a Docker image?

I have found the answer. The problem was in my docker-compose file where I needed the following line: volumes: - ~/.aws/:/root/.aws:ro

I found it on this post: AWS DotNet SDK Error: Unable to get IAM security credentials from EC2 Instance Metadata Service

by user @smcg

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM