First a little bit of background. We are building an application in AWS using CodeStar to control everything. It is being written in Python 3
But despite every attempt we are unable to get the variables we set in the buildspec.yml file to show in the environment when we deploy the code.
For example the following is essentially the buildspec.yml file.
version: 0.2
env:
variables:
PASSWORD: "abc123"
artifacts:
type: zip
files:
- template-export.yml
- '**/*'
When we then build a function which prints the entirety of the Environment variables MY_VAR does not show in the variables. The code we are using is essentially this:
import os
def handler(event, context):
PASSWORD1 = str(os.environ["PASSWORD"])
print(PASSWORD1)
As near as I can tell, it currently has a role assigned to it which gives it full permissions.I am sure there is a simple solution to this, but as of now we haven't been able to find it - despite hours spent trying to get it to work
Any assistance or pointers would be greatly appreciated.
Note - this seems very similar to:
AWS Lambda is not reading environment variables
but we are wanting to set the variables in the yaml file and not via the Lambda configuration area