Add Application Specification

In your Cloud9 environment, create a appspec.yml file in the DemoApp repository with the following content:

version: 0.0
os: linux
files:
  - source: /target/javawebdemo.war
    destination: /tmp/codedeploy-deployment-staging-area/
  - source: /scripts/configure_http_port.xsl
    destination: /tmp/codedeploy-deployment-staging-area/
hooks:
  ApplicationStop:
    - location: scripts/stop_application
      timeout: 300
  BeforeInstall:
    - location: scripts/install_dependencies
      timeout: 300
  ApplicationStart:
    - location: scripts/write_codedeploy_config.sh
    - location: scripts/start_application
      timeout: 300
  ValidateService:
    - location: scripts/basic_health_check.sh

Commit your changes to the local Git repository and push your changes to the CodeCommit-hosted repository.

cd ~/environment/DemoApp
git add .
git commit -m "Add appspec"
git push

Trigger a new build of your application so that the deployment artifact stored in S3 will contain your appspec.yml file when you are ready to test your deploy.

  1. Go to the AWS Management Console, select services then select CodeBuild under Developer Tools
  2. Select your DemoApp build project
  3. Select start build
  4. Review the default options and select start build
  5. Verify that the status proceeds from in progress to succeeded