I have a database connection string stored in AWS Systems Manager Parameter Store that I want to pass to the environment variables of an Elastic Beanstalk instance. I don't want to commit it to source code nor have to rely on the deployer setting the values on deploy or doing it manually via the web console.
I have tried Dynamic References like {{resolve:ssm:DATABASE_CONNECTION_STRING:1}}
(with and without back ticks) which work in CloudFormation stacks but not Elastic Beanstalk config.
I have tried using container_commands
like
export DATABASE_CONNECTION_STRING=`aws ssm get-parameter --name DATABASE_CONNECTION_STRING --region eu-west-1 --query Parameter.Value --output text
but the Elastic Beanstalk instance does not have the right permissions and I'm unsure how to set them.
I have tried creating a file from the contents of an S3 file using files:
and source:
but get errors.
Ideally Dynamic References would work e.g. .ebextensions/env.config
=>
OptionSettings:
aws:elasticbeanstalk:application:environment:
DATABASE_CONNECTION_STRING: {{resolve:ssm:ANNOTATOR_DATABASE_CONNECTION_STRING:1}}