Determine Deployment Group from appspec.yml

960 views Asked by At

I am using the elb scripts from https://github.com/awslabs/aws-codedeploy-samples/tree/master/load-balancing/elb to remove my ec2 instances from the load balancer before I do my code updates.

I need to define the load balancer in the ELB_LIST variable of the common_functions.sh bash script. This load balancer will be different for each environment (or deployment group).

Is there a way I can set this variable based on which deployment group I am deploying too from within this bash script?

The application artifacts will be the same, but deployed to different environments or groups and hence, different load balancers.

1

There are 1 answers

0
Luke Hutton On BEST ANSWER

Well then, after searching the forums on aws, I see they now support deployment specific environment variables.

So I can reference the deployment group from within bash and set the load balancer:

if [ "$DEPLOYMENT_GROUP_NAME" == "Staging" ]
then
    ELB_LIST="STAGING-ELB"
fi

RE http://blogs.aws.amazon.com/application-management/post/Tx1PX2XMPLYPULD/Using-CodeDeploy-Environment-Variables