I have created an dummy application under Codedeploy, then created a deployment group and added one EC2 instance under it.
I did not do any deployments yet.
I am trying to find the appropriate aws command which can get me the list of EC2 instances under a deployment group. Looking at the commands given in this list, I checked a few like
list-deployment-instances
. All of them have this parameterdeployment-id
, which is -
The unique ID of a deployment.
I guess this is generated after doing a deployment. Correct me if I am wrong. Anyways, I did not find any command yet which gives me the list of ec2 instances under a deployment group. Am I missing something?
Backgroud
- We have multiple EC2 instances behind a load balancer, running on production and some of them may need to be deployed with a different git branch (to test some feature, before rolling out on all instances and this may need to be kept during subsequent deployments).
- Our DevOps team does not use auto-scaling yet. So, they manually bring up or cut down the instances.
- During the next deployment, we would need to deploy the appropriate git branch to the group of instances, depending on which git branch they are currently on. So, before that, we would like to update the deployment group using a script which will do so by checking the git revision deployed in each of the instances.
Update - Opening Bounty
We are trying to add a sanity check before initiating deployment, to see if the total number of reachable instances (boxes go down sometimes) currently under a deployment group are less than the number when we checked last time, and if so by what margin?
In the original question, I was thinking about directly finding the instances under a deployment group, but now I realize that instances under a deployment group may not be fixed and now I am thinking of finding the tags under a deployment group and then finding the instances with those tags. I could store the count against every deployment group in a file and use it to compare next time. But, I could not find any AWS CLI command to find the instances with a given tag. I guess something like this should be available because the Code deploy dashboard allows the same.
Note - I know that if some instances are not reachable, then the final result of the deployment is shown as a success and the failed instances can be found from the AWS Code deploy dashboard. But, still, I would like to know if there could be some AWS CLI command or some API available via any SDK using which I could find the number of reachable instances under a deployment group