Reputation: 1220
I work for an independent software vendor. We have an application that creates AWS Lambda functions whenever a new variant of our application is deployed. For each instance of the application, the same functions are created, just with different configuration.
For example, one of our lambda functions does some processing and then inserts the results into an SQS queue. We already use IAM roles for credentials to the queue, but the name of the queue and region is based on the customer and where the AWS Lambda function is deployed.
The AWS Lambda functions are written in Java.
Where can we specify configuration for queue name? ... region?
NOTE: We hope that we will not need to specify the region. Our intent is to dynamically determine what region the function is running in and use that.
Upvotes: 1
Views: 144
Reputation: 452
You can specify your queue configuration as environment variables and then read them from your lambda function. You can find a more detailed explanation in here.
You can read the current region from the environment variables as per code below.
System.getenv("AWS_DEFAULT_REGION");
However, if there are any sensitive data you may want to consider Keywhiz or a similar system for distributing and managing secrets. Diogo Monica wrote last March 2017 an interesting article about Why you shouldn't use ENV variables for secret data which you may find useful.
Upvotes: 1