AWS CodeDeploy
User Guide (API Version 2014-10-06)

The procedures in this guide support the new console design. If you choose to use the older version of the console, you will find many of the concepts and basic procedures in this guide still apply. To access help in the new console, choose the information icon.

Step 5: Update and Redeploy Your "Hello, World!" Application

Now that you've successfully deployed your application revision, on the development machine, make an update to the webpage's code, and then use AWS CodeDeploy to redeploy the site. After redeployment, you should be able to see the changes on the Amazon EC2 instance.

Modify the Webpage

  1. Go to your c:\temp\HelloWorldApp subfolder and use a text editor to modify the index.html file:

    cd c:\temp\HelloWorldApp notepad index.html
  2. Revise the contents of the index.html file to change the background color and some of the text on the webpage, and then save the file:

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Hello Again, World!</title> <style> body { color: #ffffff; background-color: #66cc00; font-family: Arial, sans-serif; font-size:14px; } </style> </head> <body> <div align="center"><h1>Hello Again, World!</h1></div> <div align="center"><h2>You have successfully deployed a revision of an application using AWS CodeDeploy</h2></div> <div align="center"> <p>What to do next? Take a look through the <a href="https://aws.amazon.com/codedeploy">AWS CodeDeploy Documentation</a>.</p> </div> </body> </html>

Redeploy the Site

Now that you've modified the code, use Amazon S3 and AWS CodeDeploy to redeploy the webpage.

Bundle and upload the changes to Amazon S3 as described in Bundle the Application's Files into a Single Archive File and Push the Archive File. (As you follow those instructions, you do not need to create a new application.) Give the revision the same key as before (HelloWorld_App.zip). Upload it to the same Amazon S3 bucket you created earlier (for example, codedeploydemobucket).

Use the AWS CLI or the AWS CodeDeploy console to redeploy the site.

To redeploy the site (CLI)

Call the create-deployment command to create a deployment based on the uploaded revision, again using the application named HelloWorld_App, the deployment configuration named CodeDeployDefault.OneAtATime, the deployment group named HelloWorld_DepGroup, and the revision named HelloWorld_App.zip in the bucket named codedeploydemobucket:

aws deploy create-deployment --application-name HelloWorld_App --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name HelloWorld_DepGroup --s3-location bucket=codedeploydemobucket,bundleType=zip,key=HelloWorld_App.zip

You can check the status of the new deployment, as described in Monitor and Troubleshoot Your Deployment.

When AWS CodeDeploy has redeployed the site, revisit the site in your web browser to verify that the background color and text on the webpage have been changed. (You may need to refresh your browser.) If the background color and text has been changed, then congratulations! You've modified and redeployed your site!

To redeploy the site (console)

  1. Sign in to the AWS Management Console and open the AWS CodeDeploy console at https://console.aws.amazon.com/codedeploy.

    Note

    Sign in with the same account or IAM user information that you used in Getting Started with AWS CodeDeploy.

  2. On the navigation pane, choose Applications.

  3. In the Applications list, choose HelloWorld_App.

  4. In the Deployments tab, choose Create deployment.

    1. In the Deployment group list, choose HelloWorld_DepGroup.

    2. In Revision location, enter the Amazon S3 link for your revision.

      To find the link value:

      1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.

        Browse to and open codedeploydemobucket, and then choose your revision, HelloWorld_App.zip, in the Amazon S3 console.

      2. If the Properties pane is not visible in the Amazon S3 console, choose the Properties button.

      3. In the Properties pane, copy the value of the Link field.

      4. Return to the AWS CodeDeploy console, then paste the link into Revision location.

    3. In Revision file type, if a message appears stating that the file type could not be detected, choose .zip.

    4. Leave Deployment description blank.

    5. Expand Deployment group overridesIn the Deployment configuration list, choose CodeDeployDefault.OneAtATime, and then choose Create deployment.

      You can check the status of the deployment as described in Monitor and Troubleshoot Your Deployment.

      When AWS CodeDeploy has redeployed the site, revisit the site in your web browser to verify that the background color and text on the webpage have been changed. (You may need to refresh your browser.) If the background color and text has been changed, congratulations! You've modified and redeployed your site!