How do I get environment variables from SSM Parameter Store and use them from an Elastic Beanstalk instance shell?
2 minute read
I want to get environment variables from Parameter Store, a capability of AWS Systems Manager, and print them in an AWS Elastic Beanstalk instance shell.
Amazon Linux 2 uses the get-config script to load environment variables. Elastic Beanstalk doesn't support Parameter Store. You must integrate Parameter Store with either the .ebextension or .platform script.
Note: The following resolution uses two .ebextension files. The first configuration file, ssm.config, reads the value from the Parameter Store and adds it to the Elastic Beanstalk environment variables. The second configuration file, shell.config, exports the value to the instance shell.
To get and use environment variables from Parameter Store in your Elastic Beanstalk instance shell, complete the following steps:
2. Create the test variables in Parameter Store with string as the type.
3. Create the .ebextensionssm.config file in your application source bundle, and then add the following configurations:
4. Create another .ebextensionshell.config file in your application source bundle, and then add the following configurations: