How can I pass environment variables from circleci to my aws ec2?

So in one of my jobs, I have the following deploy command:
aws deploy create-deployment --application-name DemoApp --deployment-config-name --deployment-group-name DemoDeployment ...

which will basically run AWS Code deploy that’ll pull down from my github and deploy my apps to the ec2.

However, I couldn’t find a way to pass variable variable from circleci down to my ec2 instances. Is it even possible? I’ve tried a couple of things to no available… For example:
TEST=DUMMY aws deploy create-deployment --application-name DemoApp --deployment-config-name --deployment-group-name DemoDeployment ...

I’ve even tried this in my config.yaml:

- run:
    name: 'Deploy'
    command: >
        aws deploy create-deployment --application-name DemoApp --deployment-config-name
        --deployment-group-name DemoDeployment ....
    environment:
        TEST: DUMMY

I’ve looked everywhere but can’t seem to find solution for this. Help please?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.