For doing dev testing of my application, I use LocalStack. It is really helpful in creating AWS cloud stack locally. That cuts cost for local development & testing. Also it is easier for developers to remove any DevOps dependency for credentials & IAM accounts while developing. Once LocalStack is successfully installed, we can access AWS services like SQS or DynamoDB within the local machine. We just need to set some dummy values for AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY environment variables. I am using Ubuntu & that is easy to do. Now the issue came up when I deployed my application as a docker container in my local docker daemon. When I tried to access AWS services from inside the docker container, I got following exception:
Basically we are passing env variables with docker run command. Remember, this is only for testing and we are using dummy credentials for LocalStack. Do not pass AWS crdenetials this way when you are using actual real credentials. In stage or prod evnvironments you can use IAM role for service accounts.