I have two deployment groups for the same set of EC2 instances: one is an in-place deploy (eg. for "hot" fixes of minor significance), and the other is a blue/green deploy (eg. for bigger changes where I want surety that the app I'm running will properly run on newly-provisioned instances).
This is working well, but I have one issue: if my autoscaling group (used in the blue/green deployment group) needs to create a new instance, the new EC2 server will be provisioned with the deployment ID that the ASG is tagged with in its
CodeDeployProvisioningDeploymentId tag. This tag is only updated when I make a blue/green deployment. Because these deployments happen less frequently, this means new instances I create are often several deploys old when they're created.
What I think I need to do is find a way to update the value of the
CodeDeployProvisioningDeploymentId tag on my ASG when I deploy a change using the in-place deployment group, so it's always current. Or alternatively, in my provision script which runs on all new instances (to install dependencies etc), I could fetch the latest deployment ID and install it on the instance there and then.
Does anyone have any advice or pro tips on which way to go with this?