-
Notifications
You must be signed in to change notification settings - Fork 57
2.3
Paul Duvall edited this page Jul 13, 2020
·
7 revisions
Review and ensure that you have setup your development environment before going through the steps below.
- buildspec.yml - Build specification that runs from an AWS CodeBuild action in AWS CodePipeline.
- ccoa-2-cfn-nag-pipeline.yml - CloudFormation template that provisions AWS CodePipeline and associated resources to run the cfn_nag security static analysis tool as part of the deployment pipeline.
- volume-encrypted.yml - CloudFormation template that provisions an encrypted EBS Volume.
- volume.yml - CloudFormation template that provisions an unencrypted EBS Volume.
From your AWS Cloud9 terminal, type the following to setup your directory structure:
mkdir ~/environment/ccoa
cd ~/environment/ccoa
aws s3 mb s3://ccoa-2-$(aws sts get-caller-identity --output text --query 'Account')
mkdir lesson2
cd ~/environment/ccoa/lesson2
Create empty source files:
touch buildspec.yml
touch ccoa-2-cfn-nag-pipeline.yml
touch volume-encrypted.yml
touch volume.yml
Save the files.
- Copy the contents from buildspec.yml to your local buildspec.yml file in Cloud9 and save it.
- Copy the contents from volume.yml to your local volume.yml file in Cloud9 and save it.
- Copy the contents from volume-encrypted.yml to your local volume-encrypted.yml file in Cloud9 and save it.
- Copy the source contents from the ccoa-2-cfn-nag-pipeline.yml file and save it to your local file in your Cloud9 environment called ccoa-2-cfn-nag-pipeline.yml. This CloudFormation template provisions a deployment pipeline that runs preventive checks via cfn_nag.
cd ~/environment/ccoa/lesson2
zip ccoa-lesson2-examples.zip *.*
aws s3 sync ~/environment/ccoa/lesson2 s3://ccoa-2-$(aws sts get-caller-identity --output text --query 'Account')
From your Cloud9 terminal, type the following (replacing you@example.com):
aws cloudformation create-stack --stack-name ccoa-2-cfn-nag-pipeline --template-body file:///home/ec2-user/environment/ccoa/lesson2/ccoa-2-cfn-nag-pipeline.yml --parameters ParameterKey=EmailAddress,ParameterValue=you@example.com --capabilities CAPABILITY_NAMED_IAM --disable-rollback
From your Cloud9 terminal, type the following:
aws cloudformation describe-stacks --stack-name ccoa-2-cfn-nag-pipeline
View the CodeCommit repo
- Go to the CloudFormation console to see the stack being launched.
- Once the CloudFormation stack is successful, select the checkbox next to the stack and click the Outputs tab.
- From Outputs, click on the PipelineUrl output to open the pipeline in AWS CodePipeline
- Go to the CodeCommit repo.
- Open
buildspec.ymland change fromvolume.ymltovolume-encrypted.ymland commit the changes. - Go back to the pipeline you created and watch the change.
Go to Cleanup to remove any resources you created in this sublesson.