1. Create the AWS Pipeline

This is the target architecture we will create

Click on Deploy to AWS to launch the Cloudfomation Stack

Deploy to AWS

Complete the Cloudformation inputs.

  • Ensure that you select the correct region for thr workshop
  • Details:
    • LaunchType Fargate
    • GitHubRepo ecs-demo-php-simple-app
    • GitHubBranch master
    • GitHubUser Your GitHub Username
    • GitHubToken The token we generated in the pre-requisites
    • Acknowledge the notifications and click on create stack

The stack will take around 10 minutes to complete

Test the Deployment

  • On completion, the latest commit to the GitHub repository is run through the pipeline and deployed to ECS.
  • From the CloudFormation Console, naviogate to Stacks then click on ECS-ContinuousDeployment , then the Outputs Tab
  • Open the PipelineUrl to watch the first revision run through the CodePipeline pipeline. After the deploy step turns green, open the URL from ServiceUrl which loads a page similar to this

Commit a change to GitHub and watch the automated deployment

  • Browse tro the Repo that you forked https://github.com/yourusername/ecs-demo-php-simple-app
  • Browse to source and then “index.php” and edit the file as shown below
  • Change the file as shown below to anthing you wish and commit the file
  • Open the CodePipeline console and watch the Pipeline triggered automatically on a commit
  • Browse to the service URL and see the changes displayed

Investigate CodeBuild Build project

  • Login to the CodeBuild Console
  • Ensure you are in the Sydney Region
  • Click on the Build Project “ECS-ContinuousDeployment-DeploymentPipeline-XXX”
  • Choose the Build details tab and have a look at the Buildspec and environment sections

A buildspec is a collection of build commands and related settings, in YAML format, that CodeBuild uses to run a build. You can include a buildspec as part of the source code (GitHub) or you can define a buildspec when you create a build project. For more details refer to BuildSpec for CodeBuild