Creating a CodeDeploy group to deploy to production

We previously 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 it from the staging deployment group we previously created. 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 command to create the new deployment group:

$ aws deploy create-deployment-group 
      --application-name helloworld 
      --ec2-tag-filters Key=aws:cloudformation:stack-
name,Type=KEY_AND_VALUE,Value=helloworld-production
--deployment-group-name production --service-role-arn $arn

If everything went well, the new deployment group should be created. We can verify that by browsing to the application in the AWS CodeDeploy web page or using the command line with the following command:

$ aws deploy list-deployment-groups 
      --application-name helloworld
{
    "applicationName": "helloworld",
    "deploymentGroups": [
        "staging",
        "production"
    ]
}  
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset