AWS OpsWorks
User Guide (API Version 2013-02-18)

Step 7 (Optional): Update the app code to see CodePipeline redeploy your app automatically

When you make changes to code in apps or cookbooks that you have deployed by using CodePipeline, the updated artifacts will be deployed automatically by CodePipeline to your target instances (in this case, to a target AWS OpsWorks Stacks stack). This section shows you the automatic redeployment when you update the code in your sample Node.js app. If you still have the app code for this walkthrough stored locally, and no one else has made changes to the code since you started the walkthrough, you can skip steps 1-4 of this procedure.

To edit the code in the sample app

  1. Sign in to the AWS Management Console and open the Amazon S3 console at

  2. Open the bucket in which you are storing your sample Node.js app.

  3. Select the ZIP file that contains the app. On the Actions menu, choose Download.

  4. In the dialog box, open the context (right-click) menu, choose Download, and then save the ZIP file to a convenient location. Choose OK.

  5. Extract the contents of the ZIP file to a convenient location. You might need to change permissions on the extracted folder and its subfolders and contents to allow editing. In the opsworks-nodejs-demo-app\views folder, open the header.html file for editing.

  6. Search for the phrase, You just deployed your first app with. Replace the word deployed with updated. On the next line, change AWS OpsWorks. to AWS OpsWorks and AWS CodePipeline. Do not edit anything but the text.

  7. Save and close the header.html file.

  8. Zip the opsworks-nodejs-demo-app folder, and save the ZIP file to a convenient location. Do not change the name of the ZIP file.

  9. Upload the new ZIP file to your Amazon S3 bucket. In this walkthrough, the name of the bucket is my-appbucket.

  10. Open the CodePipeline console, and open your AWS OpsWorks Stacks pipeline (MyOpsWorksPipeline). Choose Release Change.

    (You can wait for CodePipeline to detect the code change from the updated version of the app in your Amazon S3 bucket. To save you time, this walkthrough instructs you to simply choose Release Change.)

  11. Observe as CodePipeline runs through the stages of the pipeline. First, CodePipeline detects changes to the source artifact.

    CodePipeline pushes the updated code to your stack in AWS OpsWorks Stacks.

  12. When both stages of the pipeline have been successfully completed, open your stack in AWS OpsWorks Stacks.

  13. On the stack properties page, choose Instances.

  14. In the Public IP column, choose the public IP address of your instance to view the updated app's text.