Starting and configuring our CloudFormation stack

We will proceed as usual for the first part:

$ git add helloworld-codepipeline-cf-template.py
$ git commit -m "Adding Pipeline to deploy our helloworld application using ECS"
$ git push
$ python helloworld-codepipeline-cf-template.py > helloworld-codepipeline-cf.template
$ aws cloudformation create-stack
--stack-name helloworld-codepipeline
--capabilities CAPABILITY_NAMED_IAM
--template-body file://helloworld-codepipeline-cf.template
We are using the CAPABILITY_NAMED_IAM capability in this case, as we are defining custom names at the IAM level.

This will create our pipeline. There is a small gotcha to it, which is that we didn't specify the GitHub credentials in the pipeline. The main reason for that is we don't want to store it in clear text in GitHub. AWS offers a service within IAM to do encryption, but we won't cover it in this book, therefore, we are simply going to edit the pipeline the first time around:

  1. Open https://console.aws.amazon.com/codepipeline in your browser
  2. Select your newly created pipeline
  3. Click on Edit at the top
  4. Click on the pen icon on the GitHub action:
  1. Click on Connect to GitHub on the right-hand-side menu and follow the steps to authorize AWS CodePipeline
  2. Select your helloworld project in the repository step and the master branch
  3. Click on Update, save pipeline changes, and finally, Save and Continue.

After a few seconds, your pipeline will trigger and you should see your first deployment going through. This concludes the creation of our CI/CD pipeline.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset