Menu
AWS for DevOps
Getting Started Guide

Step 3.3: Download the Source Code for AWS OpsWorks

In this step, you will download the source code that you will deploy to an AWS OpsWorks deployment target as part of Step 7.3: AWS OpsWorks Pipeline.

If you want to download the source code for AWS CodeDeploy, go to Step 3.1: AWS CodeDeploy Source Code.

If you want to download the source code for AWS Elastic Beanstalk, go to Step 3.2: Elastic Beanstalk Source Code.

To download the source code for AWS OpsWorks

  1. You should already be logged in to the instance that you launched in Step 2.3: Launch an Amazon EC2 Instance to Access the AWS CodeCommit Repository. If not, follow the instructions in Connect to Your Linux Instance in the Amazon EC2 User Guide for Linux Instances.

  2. From the instance's command prompt, run the pwd command to confirm you are in the /home/ec2-user/my-demo-repo directory (also referred to as the ~/my-demo-repo directory). If a path other than /home/ec2-user/my-demo-repo appears in the output, run the cd ~/my-demo-repo command.

  3. Download the source code for AWS OpsWorks into the ~/my-demo-repo directory, and then prepare the source code for deployment by running the following commands, one at a time.

    Copy
    wget https://github.com/awslabs/opsworks-demo-php-simple-app/archive/version1.zip
    Copy
    unzip version1.zip
    Copy
    rm version1.zip
    Copy
    cp -r opsworks-demo-php-simple-app-version1/* .
    Copy
    rm -rf opsworks-demo-php-simple-app-version1

    Because the directory structure of the https://github.com/awslabs/opsworks-demo-php-simple-app/archive/version1.zip file is not suitable for deployment as is, the preceding commands prepare the source code for deployment by:

    • Extracting the contents of the GitHub version of the ZIP file and then deleting that ZIP file.

    • Copying the contents of the opsworks-demo-php-simple-app-version1 directory in the original source code to the parent directory and then deleting the opsworks-demo-php-simple-app-version1 directory.

  4. Explore the source code. Otherwise, go to Step 3.4: Push the Source Code.

To explore the source code for AWS OpsWorks

  1. From the ~/my-demo-repo directory, run these commands to display the contents of the extracted files in read-only mode.

    Copy
    less index.php
    Copy
    less assets/css/bootstrap.min.css
    Copy
    less assets/js/bootstrap.min.js

    To move up or down one line at a time, press the k or j key, respectively. To move up or down one page at a time, press b or the space bar, respectively. To exit, press the q key.

  2. After you are finished exploring the contents, go to Step 3.4: Push the Source Code.