Skip to content
Paul Duvall edited this page Apr 29, 2019 · 18 revisions

Publishing CloudFormation templates with a Launch Stack button

In this section, you learn where to upload CloudFormation templates so that you can use them publicly via a Launch Stack button or for other purposes. There is a CodePipeline that runs in Stelligent's production account that copies all files in this repo to an S3 bucket set to public-read.

  1. From your user directory, clone this repo (or get the latest via git pull):

git clone https://github.com/stelligent/cloudformation_templates.git

  1. Change the directory to labs:

cd ~/cloudformation_templates/labs

  1. Make a new directory or use an existing directory within labs. In this example, I am using _example:

mkdir _example

  1. Change to the new directory:

cd _example

  1. Make an empty CloudFormation template:

touch example.yml

  1. Put the CloudFormation template configuration in this file and save

  2. After testing against an AWS account, commit the code to GitHub:

git add ~/cloudformation_templates/labs/_example

git commit -am "new CloudFormation template used in Stelligent blog && git push

  1. Go to the blog you're editing and put the following in the HTML text (making the approriate changes based on the name of your directory/CloudFormation template name and updating STACK-NAME to the default name of the stack):

<a href="https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=STACK-NAME&amp;templateURL=https://s3.amazonaws.com/cloudformation-templates-stelligent/labs/_example/example.yml"><img class="alignnone" src="https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png" alt="" width="144" height="27"/></a><div>

The above HTML markup gets converted in this:

Launch CFN stack

Creating a cloudformation_templates panel

  1. Create a new folder in this repo or commit files to an existing folder if a similar topic. For example, if you're creating a lab, create a new folder under labs.
  2. Refer to the previously committed CloudFormation template file
  3. Upload the image you downloaded from CloudFormation Designer to S3. For example: https://s3.amazonaws.com/stelligent-public/media/cloudformation-diagrams/ecs-jenkins.jpg.
  4. Create a new section in the CloudFormation Templates README. For example, see Containerized CI Solutions in AWS: Jenkins in ECS Lab. This will include a brief description, create details, launch stack button, design thumbnail/link, video link, and command-line options.