softwaremill / softwaremill/elasticmq
Default credentials from environment variables in Docker image
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 2.9k
- Forks
- 203
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
When working with the Docker image locally, that allows configuring any sort of key / secret on the client's DSN value.
When not configuring any client, the SQS default policy is to then connect to IAM to retrieve credentials / profile to determine region / credentials. The following notices then will get logged by common loggers (Symfony in this example):
[2023-03-13T15:50:53.777467+01:00] app.INFO: Failed to fetch Profile from Instance Metadata. {"exception":"[object] (Symfony\Component\HttpClient\Exception\TimeoutException(code: 0): Idle timeout reached for "http://169.254.169.254/latest/meta-data/iam/security-credentials\". at /application/vendor/symfony/http-client/Chunk/ErrorChunk.php:56)"} []
[2023-03-13T15:50:53.825898+01:00] app.INFO: Try #2 after 2072ms: Idle timeout reached for "http://169.254.169.254/latest/meta-data/iam/security-credentials". {"count":2,"delay":2072} []
Findings
- The queues nicely get "auto setup" (the client initially gets a http 400 error first and then has to retry)
- The events nicely get dispatched / published to the queue
- The events nicely get consumed from the queue
But, when connecting without key/secret credentials in the DSN, the logs will retrieve records of not being able to access 169.254.169.254, which is an on EC2 internally mapped service that is not accessible during local development. This IAM server typically will not be accessible when doing local development.
Suggested changes
- Allow to configure default key / secret credentials via environment variables
- Let the container bootstrap script detect these environment variables, and set those as the credentials
- Option: an extra environment variable to only allow dispatching events with the credentials as provided
- DX: enhance the documentation / README to mention that SQS typically will connect to IAM to determine credentials, when not providing them through the client's DSN, and that you by default can use any key / secret.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the Docker image's container bootstrap script and the README for current credential handling. Trace how environment variables could be passed into the SQS client configuration, then verify that local startup uses the supplied credentials without attempting EC2 metadata access.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, docker, scala
- Domain
- cloud, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100