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

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

When you make changes to code in apps or cookbooks that you have deployed by using AWS CodePipeline, the updated artifacts will be deployed automatically by AWS 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 PHP app.

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 PHP 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-demo-php-simple-app-version1 folder, open the index.php file for editing.

  6. Search for the phrase, Your PHP application is now running. Replace the text, Your PHP application is now running with You've just deployed your first app to AWS OpsWorks with AWS CodePipeline,. Do not edit the variables.

  7. Save and close the index.php file.

  8. Zip the opsworks-demo-php-simple-app-version1 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 AWS CodePipeline console, and open your AWS OpsWorks Stacks pipeline (MyOpsWorksPipeline). Choose Release Change.

    (You can wait for AWS 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 AWS CodePipeline runs through the stages of the pipeline. First, AWS CodePipeline detects changes to the source artifact.

    AWS 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 (MyStack).

  13. On the MyStack 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.