Previously, we created a CodeDeploy application and a first deployment group that allowed us to deploy our code to staging. Using the command-line interface, we are now going to add a new deployment group to deploy our code to our newly created production environment.
One of the parameters needed to add new deployment groups is the arn of the policy we created initially. We can easily extract this from the staging deployment group that we created previously. We will store the result in a variable called arn:
$ arn=$(aws deploy get-deployment-group \ --application-name helloworld \ --deployment-group-name staging \ --query 'deploymentGroupInfo.serviceRoleArn')
We can now run the following ...