Menu
AWS for DevOps
Getting Started Guide

Step 3.1: Download the Source Code for AWS CodeDeploy

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

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

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

To download the source code for AWS CodeDeploy

  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 command prompt on the instance, run the pwd command to confirm that 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 CodeDeploy 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://s3.amazonaws.com/aws-codedeploy-us-east-1/samples/latest/SampleApp_Linux.zip
    Copy
    unzip SampleApp_Linux.zip
    Copy
    rm SampleApp_Linux.zip
  4. Explore the source code. Otherwise, go to Step 3.4: Push the Source Code.

To explore the source code for AWS CodeDeploy

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

    Copy
    less appspec.yml
    Copy
    less index.html
    Copy
    less scripts/install_dependencies
    Copy
    less scripts/start_server
    Copy
    less scripts/stop_server

    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.

    The appspec.yml file contains a set of AWS CodeDeploy deployment commands. These commands instruct AWS CodeDeploy to deploy the index.html file to the instance and to install and start a web server on the instance. For more information, see the AWS CodeDeploy AppSpec File Reference in the AWS CodeDeploy User Guide.

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