From bb182647e2b5ff43afb55ed9043850bec10ed72a Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 15:45:10 +0000 Subject: [PATCH 01/28] change from stelligent to PauLDuvall --- pipeline-taskcat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline-taskcat.yml b/pipeline-taskcat.yml index 5cf623e..d59e453 100644 --- a/pipeline-taskcat.yml +++ b/pipeline-taskcat.yml @@ -5,7 +5,7 @@ Parameters: GitHubUser: Type: String Description: GitHub User - Default: "stelligent" + Default: "PaulDuvall" GitHubRepo: Type: String Description: GitHub Repo to pull from. Only the Name. not the URL From 8f9ffcef956532f8def74b16f056220ab20fed1e Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 15:47:55 +0000 Subject: [PATCH 02/28] update EB solution to use Node 12 --- samples/beanstalk/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/beanstalk/pipeline.yml b/samples/beanstalk/pipeline.yml index 8d2c451..c96f8bc 100644 --- a/samples/beanstalk/pipeline.yml +++ b/samples/beanstalk/pipeline.yml @@ -34,7 +34,7 @@ Parameters: MySolutionStackName: Description: Name of the current solution stack name. See https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html Type: String - Default: 64bit Amazon Linux 2018.03 v4.14.1 running Node.js + Default: "64bit Amazon Linux 2 v5.1.0 running Node.js 12" ConstraintDescription: Can contain only ASCII characters. Metadata: AWS::CloudFormation::Interface: From 5b6e803d637c1db09da8207ca9cbb97c6513a0f6 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 15:52:32 +0000 Subject: [PATCH 03/28] no quotes in EB solution --- samples/beanstalk/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/beanstalk/pipeline.yml b/samples/beanstalk/pipeline.yml index c96f8bc..660b68e 100644 --- a/samples/beanstalk/pipeline.yml +++ b/samples/beanstalk/pipeline.yml @@ -34,7 +34,7 @@ Parameters: MySolutionStackName: Description: Name of the current solution stack name. See https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html Type: String - Default: "64bit Amazon Linux 2 v5.1.0 running Node.js 12" + Default: 64bit Amazon Linux 2 v5.1.0 running Node.js 12 ConstraintDescription: Can contain only ASCII characters. Metadata: AWS::CloudFormation::Interface: From aba551c2c77cc01a007baeb7504609f27db2a1b6 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 16:05:16 +0000 Subject: [PATCH 04/28] add InstanceProfile and Role --- samples/beanstalk/pipeline.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/samples/beanstalk/pipeline.yml b/samples/beanstalk/pipeline.yml index 660b68e..0b37dca 100644 --- a/samples/beanstalk/pipeline.yml +++ b/samples/beanstalk/pipeline.yml @@ -122,6 +122,35 @@ Resources: Ref: nodeConfigurationTemplate VersionLabel: Ref: nodeApplicationVersion + OptionSettings: + - Namespace: 'aws:autoscaling:launchconfiguration' + OptionName: IamInstanceProfile + Value: !Ref InstanceProfile + - Namespace: 'aws:elasticbeanstalk:environment' + OptionName: InstanceProfileRole + Value: !Ref InstanceProfileRole + InstanceProfileRole: + Type: AWS::IAM::Role + Properties: + AssumeRolePolicyDocument: + Version: "2012-10-17" + Statement: + - + Effect: "Allow" + Principal: + Service: + - "ec2.amazonaws.com" + Action: + - "sts:AssumeRole" + ManagedPolicyArns: + - "arn:aws:iam::aws:policy/AWSElasticBeanstalkWorkerTier" + RoleName: "scorekeep-beanstalk-ecs-role" + InstanceProfile: + Type: "AWS::IAM::InstanceProfile" + Properties: + Roles: + - !Ref 'InstanceProfileRole' + InstanceProfileName: "scorekeep-beanstalk-ecs-role" CodePipelineRole: Type: AWS::IAM::Role Properties: From 919bfaf390a826b15c8377553e71f705f7a2b92b Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 16:18:20 +0000 Subject: [PATCH 05/28] change OptionName to ServiceRole --- samples/beanstalk/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/beanstalk/pipeline.yml b/samples/beanstalk/pipeline.yml index 0b37dca..c977c6c 100644 --- a/samples/beanstalk/pipeline.yml +++ b/samples/beanstalk/pipeline.yml @@ -127,7 +127,7 @@ Resources: OptionName: IamInstanceProfile Value: !Ref InstanceProfile - Namespace: 'aws:elasticbeanstalk:environment' - OptionName: InstanceProfileRole + OptionName: ServiceRole Value: !Ref InstanceProfileRole InstanceProfileRole: Type: AWS::IAM::Role From 3fb8fb5e4fb1dead7ac5483a88d0fb781b402375 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 16:23:05 +0000 Subject: [PATCH 06/28] remove Rolenane --- samples/beanstalk/pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/beanstalk/pipeline.yml b/samples/beanstalk/pipeline.yml index c977c6c..f214bce 100644 --- a/samples/beanstalk/pipeline.yml +++ b/samples/beanstalk/pipeline.yml @@ -144,13 +144,13 @@ Resources: - "sts:AssumeRole" ManagedPolicyArns: - "arn:aws:iam::aws:policy/AWSElasticBeanstalkWorkerTier" - RoleName: "scorekeep-beanstalk-ecs-role" + # RoleName: "scorekeep-beanstalk-ecs-role" InstanceProfile: Type: "AWS::IAM::InstanceProfile" Properties: Roles: - !Ref 'InstanceProfileRole' - InstanceProfileName: "scorekeep-beanstalk-ecs-role" + # InstanceProfileName: "scorekeep-beanstalk-ecs-role" CodePipelineRole: Type: AWS::IAM::Role Properties: From a88a5c7d4eb61d92705d6fbe09da4b33615d67b9 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 18:16:27 +0000 Subject: [PATCH 07/28] delete non-failed stacks --- buildspec.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildspec.yml b/buildspec.yml index 496b1c7..0f9dfd5 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -14,8 +14,8 @@ phases: build: commands: - echo Build phase started on `date` - # - taskcat test run - - taskcat test run --no-delete + # - taskcat test run --no-delete + - taskcat test run -k post_build: commands: - echo Build completed on `date` From ceaef601696559525c85fedaa2a248bc6f834081 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 19:00:06 +0000 Subject: [PATCH 08/28] add Deletion and Update Policy on S3 bucket --- samples/beanstalk/pipeline.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/samples/beanstalk/pipeline.yml b/samples/beanstalk/pipeline.yml index f214bce..fd7cbdd 100644 --- a/samples/beanstalk/pipeline.yml +++ b/samples/beanstalk/pipeline.yml @@ -144,13 +144,11 @@ Resources: - "sts:AssumeRole" ManagedPolicyArns: - "arn:aws:iam::aws:policy/AWSElasticBeanstalkWorkerTier" - # RoleName: "scorekeep-beanstalk-ecs-role" InstanceProfile: Type: "AWS::IAM::InstanceProfile" Properties: Roles: - !Ref 'InstanceProfileRole' - # InstanceProfileName: "scorekeep-beanstalk-ecs-role" CodePipelineRole: Type: AWS::IAM::Role Properties: @@ -218,7 +216,8 @@ Resources: Version: '2012-10-17' ArtifactBucket: Type: AWS::S3::Bucket - DeletionPolicy: Delete + DeletionPolicy: Retain + UpdateReplacePolicy: Retain CodePipelineStack: Type: AWS::CodePipeline::Pipeline DependsOn: From a047cd77277a35e9e7b2fc4d08cd2c78ce31c060 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 19:25:18 +0000 Subject: [PATCH 09/28] update OpsWorks URL in samples README --- samples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/README.md b/samples/README.md index a7e0868..97f79e3 100644 --- a/samples/README.md +++ b/samples/README.md @@ -8,7 +8,7 @@ Solution | Launch Template | README ------------ | ------------- | ------------- **Static** | [![Launch Static Website Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-static&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/static/pipeline.yml) | [README](./static) **EC2** | [![Launch EC2 Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-ec2&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/ec2/pipeline.yml) | [README](./ec2) -**OpsWorks** | [![Launch OpsWorks Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-opsworks%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/opsworks/pipeline.yml) | [README](./opsworks) +**OpsWorks** | [![Launch OpsWorks Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-opsworks&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/opsworks/pipeline.yml) | [README](./static) **Elastic Beanstalk** | [![Launch Elastic Beanstalk Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-beanstalk%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/beanstalk/pipeline.yml) | [README](./beanstalk) **ECS** | [![Launch ECS Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-ecs%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/ecs/pipeline.yml) | [README](./ecs) **Serverless** | [![Launch Serverless Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-serverless%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/serverless/pipeline.yml) | [README](./serverless) From d026f210dda38316bd39339dfa2382e93960751d Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 19:30:06 +0000 Subject: [PATCH 10/28] update remainder of Launch Stack URLs in samples README --- samples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/README.md b/samples/README.md index 97f79e3..1e257f4 100644 --- a/samples/README.md +++ b/samples/README.md @@ -8,7 +8,7 @@ Solution | Launch Template | README ------------ | ------------- | ------------- **Static** | [![Launch Static Website Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-static&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/static/pipeline.yml) | [README](./static) **EC2** | [![Launch EC2 Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-ec2&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/ec2/pipeline.yml) | [README](./ec2) -**OpsWorks** | [![Launch OpsWorks Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-opsworks&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/opsworks/pipeline.yml) | [README](./static) +**OpsWorks** | [![Launch OpsWorks Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-opsworks&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/opsworks/pipeline.yml) | [README](./opsworks) **Elastic Beanstalk** | [![Launch Elastic Beanstalk Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-beanstalk%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/beanstalk/pipeline.yml) | [README](./beanstalk) **ECS** | [![Launch ECS Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-ecs%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/ecs/pipeline.yml) | [README](./ecs) **Serverless** | [![Launch Serverless Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-serverless%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/serverless/pipeline.yml) | [README](./serverless) From 005195cff50da89ceb8b9a75c7b5fbcc8b6db931 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 19:30:47 +0000 Subject: [PATCH 11/28] update remainder of Launch Stack URLs in samples README --- samples/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/samples/README.md b/samples/README.md index 1e257f4..1a7a96c 100644 --- a/samples/README.md +++ b/samples/README.md @@ -9,11 +9,10 @@ Solution | Launch Template | README **Static** | [![Launch Static Website Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-static&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/static/pipeline.yml) | [README](./static) **EC2** | [![Launch EC2 Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-ec2&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/ec2/pipeline.yml) | [README](./ec2) **OpsWorks** | [![Launch OpsWorks Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-opsworks&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/opsworks/pipeline.yml) | [README](./opsworks) -**Elastic Beanstalk** | [![Launch Elastic Beanstalk Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-beanstalk%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/beanstalk/pipeline.yml) | [README](./beanstalk) -**ECS** | [![Launch ECS Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-ecs%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/ecs/pipeline.yml) | [README](./ecs) -**Serverless** | [![Launch Serverless Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-serverless%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/serverless/pipeline.yml) | [README](./serverless) -**Alexa** | [![Launch Serverless Stack for Alexa with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-alexa%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/serverless/alexa/pipeline.yml) | [README](./serverless/alexa) - +**EB** | [![Launch Elastic Beanstalk Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-beanstalk&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/beanstalk/pipeline.yml) | [README](./beanstalk) +**ECS** | [![Launch ECS Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-ecs&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/ecs/pipeline.yml) | [README](./ecs) +**Serverless** | [![Launch Serverless Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-serverless&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/serverless/pipeline.yml) | [README](./serverless) +**Alexa** | [![Launch Serverless Stack for Alexa with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-alexa&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/serverless/alexa/pipeline.yml) | [README](./serverless/alexa) # Changes 1. Go to [Find a Color](http://htmlcolorcodes.com/) From 7562c1916e10aae257e5fb69affefb3197adf058 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 19:59:59 +0000 Subject: [PATCH 12/28] provide README instructions for running Beanstalk stack --- samples/README.md | 2 +- samples/beanstalk/README.md | 32 +++++++++++++++++--------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/samples/README.md b/samples/README.md index 1a7a96c..098ea77 100644 --- a/samples/README.md +++ b/samples/README.md @@ -9,7 +9,7 @@ Solution | Launch Template | README **Static** | [![Launch Static Website Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-static&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/static/pipeline.yml) | [README](./static) **EC2** | [![Launch EC2 Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-ec2&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/ec2/pipeline.yml) | [README](./ec2) **OpsWorks** | [![Launch OpsWorks Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-opsworks&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/opsworks/pipeline.yml) | [README](./opsworks) -**EB** | [![Launch Elastic Beanstalk Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-beanstalk&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/beanstalk/pipeline.yml) | [README](./beanstalk) +**Elastic Beanstalk** | [![Launch Elastic Beanstalk Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-beanstalk&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/beanstalk/pipeline.yml) | [README](./beanstalk) **ECS** | [![Launch ECS Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-ecs&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/ecs/pipeline.yml) | [README](./ecs) **Serverless** | [![Launch Serverless Stack with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-serverless&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/serverless/pipeline.yml) | [README](./serverless) **Alexa** | [![Launch Serverless Stack for Alexa with CloudFormation](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template?stackName=devops-essentials-alexa&templateURL=https://s3.amazonaws.com/www.devopsessentialsaws.com/samples/serverless/alexa/pipeline.yml) | [README](./serverless/alexa) diff --git a/samples/beanstalk/README.md b/samples/beanstalk/README.md index f551cfe..5632cac 100644 --- a/samples/beanstalk/README.md +++ b/samples/beanstalk/README.md @@ -4,32 +4,34 @@ AWS Elastic Beanstalk Examples. # Overview This repo is a demonstration of Continuous Delivery of a static website to Elastic Beanstalk via CodePipeline, CodeCommit, CodeBuild, and Elastic Beanstalk. Ensure you've configured the [Prerequisites](https://github.com/stelligent/devops-essentials/wiki/Prerequisites) before launching the stack below. -# Upload html.zip file - -1. Download [html.zip](https://github.com/stelligent/devops-essentials/blob/master/samples/beanstalk/html.zip) from GitHub -1. Create a new S3 bucket and make note of the unique bucketname name you created # Launch Stack +From your [AWS Cloud9](https://github.com/paulduvall/aws-compliance-workshop/wiki/0.2#setup-aws-cloud9) terminal, type the following to setup your directory structure: + +``` +cd ~/environment +aws s3 mb s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') +aws s3 mb s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') +git clone https://github.com/PaulDuvall/devops-essentials.git +cd devops-essentials/beanstalk +zip -r doea-samples.zip . -x '*.git*' +aws s3 sync ~/environment/devops-essentials/beanstalk/ s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') +aws s3 sync ~/environment/devops-essentials/beanstalk/html.zip s3://doea-eb-sitebucket$(aws sts get-caller-identity --output text --query 'Account') +``` +## Launch the CloudFormation stack from the CLI -# Configure Solution +From your Cloud9 terminal, type the following: -## Before Launching the Stack +``` +aws cloudformation create-stack --stack-name doea-beanstalk --capabilities CAPABILITY_NAMED_IAM --disable-rollback --template-body file:///home/ec2-user/environment/devops-essentials/beanstalk/pipeline.yml --parameters ParameterKey=EmailAddress,ParameterValue=fake-email@fake-fake-fake-email.com ParameterKey=CodeCommitS3Bucket,ParameterValue=doea-eb-$(aws sts get-caller-identity --output text --query 'Account') ParameterKey=CodeCommitS3Key,ParameterValue=doea-samples.zip ParameterKey=S3Bucket,ParameterValue=doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') +``` -[![Launch CFN stack](https://s3.amazonaws.com/www.devopsessentialsaws.com/img/deploy-to-aws.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#cstack=sn%7Edevops-essentials-beanstalk%7Cturl%7Ehttps://s3.amazonaws.com/www.devopsessentialsaws.com/samples/beanstalk/pipeline.yml) -1. When launching the stack, enter the name of the S3 Bucket you created in the `S3Bucket` CloudFormation parameter ## After Launching the Stack 1. Once the CloudFormation stack is successful, select the checkbox next to the stack and click the **Outputs** tab. 1. From Outputs, click on the **PipelineUrl** output. The Source action will be in a failed state. -1. From the CodePipeline Source action, click on the CodeCommit provider and copy the **git clone** statement provided by CodeCommit -1. Paste the command in your Terminal -1. From [this](../beanstalk) folder, copy all of its *contents* to your locally cloned Git repo -1. From your Terminal, type `git add .` -1. From your Terminal, type `git commit -am "add new files"` -1. From your Terminal, type `git push` -1. Go back to your pipeline in CodePipeline and see the changes flow through the pipeline 1. Once the pipeline is complete, go to your CloudFormation Outputs and click on the **SiteUrl** Output # Resources From 271df90d1dc5cf200621ce649ed199f65e1c79dd Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 20:02:24 +0000 Subject: [PATCH 13/28] provide README instructions for running Beanstalk stack --- samples/beanstalk/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/beanstalk/README.md b/samples/beanstalk/README.md index 5632cac..32afb09 100644 --- a/samples/beanstalk/README.md +++ b/samples/beanstalk/README.md @@ -15,9 +15,9 @@ aws s3 mb s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Acco aws s3 mb s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') git clone https://github.com/PaulDuvall/devops-essentials.git cd devops-essentials/beanstalk -zip -r doea-samples.zip . -x '*.git*' +zip -r doea-eb-samples.zip . -x '*.git*' aws s3 sync ~/environment/devops-essentials/beanstalk/ s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') -aws s3 sync ~/environment/devops-essentials/beanstalk/html.zip s3://doea-eb-sitebucket$(aws sts get-caller-identity --output text --query 'Account') +aws s3 sync ~/environment/devops-essentials/beanstalk/html.zip s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') ``` ## Launch the CloudFormation stack from the CLI @@ -25,7 +25,7 @@ aws s3 sync ~/environment/devops-essentials/beanstalk/html.zip s3://doea-eb-site From your Cloud9 terminal, type the following: ``` -aws cloudformation create-stack --stack-name doea-beanstalk --capabilities CAPABILITY_NAMED_IAM --disable-rollback --template-body file:///home/ec2-user/environment/devops-essentials/beanstalk/pipeline.yml --parameters ParameterKey=EmailAddress,ParameterValue=fake-email@fake-fake-fake-email.com ParameterKey=CodeCommitS3Bucket,ParameterValue=doea-eb-$(aws sts get-caller-identity --output text --query 'Account') ParameterKey=CodeCommitS3Key,ParameterValue=doea-samples.zip ParameterKey=S3Bucket,ParameterValue=doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') +aws cloudformation create-stack --stack-name doea-beanstalk --capabilities CAPABILITY_NAMED_IAM --disable-rollback --template-body file:///home/ec2-user/environment/devops-essentials/beanstalk/pipeline.yml --parameters ParameterKey=EmailAddress,ParameterValue=fake-email@fake-fake-fake-email.com ParameterKey=CodeCommitS3Bucket,ParameterValue=doea-eb-$(aws sts get-caller-identity --output text --query 'Account') ParameterKey=CodeCommitS3Key,ParameterValue=doea-eb-samples.zip ParameterKey=S3Bucket,ParameterValue=doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') ``` From 5e01a8db7af824b471505998f9d2278267d83ecd Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 20:04:23 +0000 Subject: [PATCH 14/28] add tmp-doea dir --- samples/beanstalk/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/beanstalk/README.md b/samples/beanstalk/README.md index 32afb09..83f87c1 100644 --- a/samples/beanstalk/README.md +++ b/samples/beanstalk/README.md @@ -13,11 +13,11 @@ From your [AWS Cloud9](https://github.com/paulduvall/aws-compliance-workshop/wik cd ~/environment aws s3 mb s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') aws s3 mb s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') -git clone https://github.com/PaulDuvall/devops-essentials.git -cd devops-essentials/beanstalk +git clone https://github.com/PaulDuvall/devops-essentials.git tmp-doea +cd tmp-doea/devops-essentials/beanstalk zip -r doea-eb-samples.zip . -x '*.git*' -aws s3 sync ~/environment/devops-essentials/beanstalk/ s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') -aws s3 sync ~/environment/devops-essentials/beanstalk/html.zip s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') +aws s3 sync ~/environment/tmp-doea/devops-essentials/beanstalk/ s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') +aws s3 sync ~/environment/tmp-doea/devops-essentials/beanstalk/html.zip s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') ``` ## Launch the CloudFormation stack from the CLI @@ -25,7 +25,7 @@ aws s3 sync ~/environment/devops-essentials/beanstalk/html.zip s3://doea-eb-site From your Cloud9 terminal, type the following: ``` -aws cloudformation create-stack --stack-name doea-beanstalk --capabilities CAPABILITY_NAMED_IAM --disable-rollback --template-body file:///home/ec2-user/environment/devops-essentials/beanstalk/pipeline.yml --parameters ParameterKey=EmailAddress,ParameterValue=fake-email@fake-fake-fake-email.com ParameterKey=CodeCommitS3Bucket,ParameterValue=doea-eb-$(aws sts get-caller-identity --output text --query 'Account') ParameterKey=CodeCommitS3Key,ParameterValue=doea-eb-samples.zip ParameterKey=S3Bucket,ParameterValue=doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') +aws cloudformation create-stack --stack-name doea-beanstalk --capabilities CAPABILITY_NAMED_IAM --disable-rollback --template-body file:///home/ec2-user/environment/tmp-doea/devops-essentials/beanstalk/pipeline.yml --parameters ParameterKey=EmailAddress,ParameterValue=fake-email@fake-fake-fake-email.com ParameterKey=CodeCommitS3Bucket,ParameterValue=doea-eb-$(aws sts get-caller-identity --output text --query 'Account') ParameterKey=CodeCommitS3Key,ParameterValue=doea-eb-samples.zip ParameterKey=S3Bucket,ParameterValue=doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') ``` From 2c90c2565f8db5fb0d24c879ca5860825e35a059 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 20:09:12 +0000 Subject: [PATCH 15/28] use dir --- samples/beanstalk/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/beanstalk/README.md b/samples/beanstalk/README.md index 83f87c1..394aa83 100644 --- a/samples/beanstalk/README.md +++ b/samples/beanstalk/README.md @@ -15,7 +15,7 @@ aws s3 mb s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Acco aws s3 mb s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') git clone https://github.com/PaulDuvall/devops-essentials.git tmp-doea cd tmp-doea/devops-essentials/beanstalk -zip -r doea-eb-samples.zip . -x '*.git*' +zip -r doea-eb-samples.zip ./tmp-doea/devops-essentials/beanstalk -x '*.git*' aws s3 sync ~/environment/tmp-doea/devops-essentials/beanstalk/ s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') aws s3 sync ~/environment/tmp-doea/devops-essentials/beanstalk/html.zip s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') ``` From a30ff041c64c33702eb1a606a15c262edd7daf57 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 20:17:36 +0000 Subject: [PATCH 16/28] remove devops-essentials from path --- samples/beanstalk/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/beanstalk/README.md b/samples/beanstalk/README.md index 394aa83..d97ea92 100644 --- a/samples/beanstalk/README.md +++ b/samples/beanstalk/README.md @@ -14,10 +14,10 @@ cd ~/environment aws s3 mb s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') aws s3 mb s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') git clone https://github.com/PaulDuvall/devops-essentials.git tmp-doea -cd tmp-doea/devops-essentials/beanstalk -zip -r doea-eb-samples.zip ./tmp-doea/devops-essentials/beanstalk -x '*.git*' -aws s3 sync ~/environment/tmp-doea/devops-essentials/beanstalk/ s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') -aws s3 sync ~/environment/tmp-doea/devops-essentials/beanstalk/html.zip s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') +cd tmp-doea/beanstalk +zip -r doea-eb-samples.zip ./tmp-doea/beanstalk -x '*.git*' +aws s3 sync ~/environment/tmp-doea/beanstalk/ s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') +aws s3 sync ~/environment/tmp-doea/beanstalk/html.zip s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') ``` ## Launch the CloudFormation stack from the CLI @@ -25,7 +25,7 @@ aws s3 sync ~/environment/tmp-doea/devops-essentials/beanstalk/html.zip s3://doe From your Cloud9 terminal, type the following: ``` -aws cloudformation create-stack --stack-name doea-beanstalk --capabilities CAPABILITY_NAMED_IAM --disable-rollback --template-body file:///home/ec2-user/environment/tmp-doea/devops-essentials/beanstalk/pipeline.yml --parameters ParameterKey=EmailAddress,ParameterValue=fake-email@fake-fake-fake-email.com ParameterKey=CodeCommitS3Bucket,ParameterValue=doea-eb-$(aws sts get-caller-identity --output text --query 'Account') ParameterKey=CodeCommitS3Key,ParameterValue=doea-eb-samples.zip ParameterKey=S3Bucket,ParameterValue=doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') +aws cloudformation create-stack --stack-name doea-beanstalk --capabilities CAPABILITY_NAMED_IAM --disable-rollback --template-body file:///home/ec2-user/environment/tmp-doea/beanstalk/pipeline.yml --parameters ParameterKey=EmailAddress,ParameterValue=fake-email@fake-fake-fake-email.com ParameterKey=CodeCommitS3Bucket,ParameterValue=doea-eb-$(aws sts get-caller-identity --output text --query 'Account') ParameterKey=CodeCommitS3Key,ParameterValue=doea-eb-samples.zip ParameterKey=S3Bucket,ParameterValue=doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') ``` From 0543639c748b63064fad0f4d4a42620ec35bbf5b Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 20:33:41 +0000 Subject: [PATCH 17/28] change location of zip file for CodeCommit --- samples/beanstalk/README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/samples/beanstalk/README.md b/samples/beanstalk/README.md index d97ea92..53e028b 100644 --- a/samples/beanstalk/README.md +++ b/samples/beanstalk/README.md @@ -10,14 +10,15 @@ This repo is a demonstration of Continuous Delivery of a static website to Elast From your [AWS Cloud9](https://github.com/paulduvall/aws-compliance-workshop/wiki/0.2#setup-aws-cloud9) terminal, type the following to setup your directory structure: ``` +sudo rm -rf ~/environment/tmp-doea cd ~/environment aws s3 mb s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') aws s3 mb s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') git clone https://github.com/PaulDuvall/devops-essentials.git tmp-doea -cd tmp-doea/beanstalk -zip -r doea-eb-samples.zip ./tmp-doea/beanstalk -x '*.git*' -aws s3 sync ~/environment/tmp-doea/beanstalk/ s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') -aws s3 sync ~/environment/tmp-doea/beanstalk/html.zip s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') +cd tmp-doea/samples/beanstalk +zip -r doea-eb-samples.zip -x '*.git*' +aws s3 sync ~/environment/tmp-doea/samples/beanstalk/ s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') +aws s3 sync ~/environment/tmp-doea/samples/beanstalk s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') ``` ## Launch the CloudFormation stack from the CLI @@ -25,7 +26,7 @@ aws s3 sync ~/environment/tmp-doea/beanstalk/html.zip s3://doea-eb-sitebucket-$( From your Cloud9 terminal, type the following: ``` -aws cloudformation create-stack --stack-name doea-beanstalk --capabilities CAPABILITY_NAMED_IAM --disable-rollback --template-body file:///home/ec2-user/environment/tmp-doea/beanstalk/pipeline.yml --parameters ParameterKey=EmailAddress,ParameterValue=fake-email@fake-fake-fake-email.com ParameterKey=CodeCommitS3Bucket,ParameterValue=doea-eb-$(aws sts get-caller-identity --output text --query 'Account') ParameterKey=CodeCommitS3Key,ParameterValue=doea-eb-samples.zip ParameterKey=S3Bucket,ParameterValue=doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') +aws cloudformation create-stack --stack-name doea-beanstalk --capabilities CAPABILITY_NAMED_IAM --disable-rollback --template-body file:///home/ec2-user/environment/tmp-doea/samples/beanstalk/pipeline.yml --parameters ParameterKey=EmailAddress,ParameterValue=fake-email@fake-fake-fake-email.com ParameterKey=CodeCommitS3Bucket,ParameterValue=doea-eb-$(aws sts get-caller-identity --output text --query 'Account') ParameterKey=CodeCommitS3Key,ParameterValue=doea-eb-samples.zip ParameterKey=S3Bucket,ParameterValue=doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') ``` From f0f1b6ca032315d0f8a77ec7c5b9dd35fd724064 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 17 Jul 2020 21:11:07 +0000 Subject: [PATCH 18/28] create zip from current beanstalk dir --- samples/beanstalk/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/beanstalk/README.md b/samples/beanstalk/README.md index 53e028b..c54e44d 100644 --- a/samples/beanstalk/README.md +++ b/samples/beanstalk/README.md @@ -16,7 +16,7 @@ aws s3 mb s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Acco aws s3 mb s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') git clone https://github.com/PaulDuvall/devops-essentials.git tmp-doea cd tmp-doea/samples/beanstalk -zip -r doea-eb-samples.zip -x '*.git*' +zip -r doea-eb-samples.zip . -x '*.git*' aws s3 sync ~/environment/tmp-doea/samples/beanstalk/ s3://doea-eb-$(aws sts get-caller-identity --output text --query 'Account') aws s3 sync ~/environment/tmp-doea/samples/beanstalk s3://doea-eb-sitebucket-$(aws sts get-caller-identity --output text --query 'Account') ``` From e918abcdb89ab5f73fb132209727cbda0a991ee6 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 21 Aug 2020 15:46:16 +0000 Subject: [PATCH 19/28] add PIPELINE_BUCKET env var, latest build image, replace S3 bucket name using token --- .taskcat.yml | 8 ++++---- buildspec-setup.yml | 22 +++++++++++----------- pipeline-taskcat.yml | 13 +++++++++---- samples/beanstalk/pipeline.yml | 2 +- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/.taskcat.yml b/.taskcat.yml index 1637a64..044a125 100644 --- a/.taskcat.yml +++ b/.taskcat.yml @@ -18,8 +18,8 @@ tests: beanstalk: parameters: EmailAddress: fake-email@fake-fake-fake-email.com - S3Bucket: deoa-wkshop-abcd - S3Key: deoa-beanstalk-examples.zip - CodeCommitS3Bucket: deoa-wkshop-abcd - CodeCommitS3Key: deoa-beanstalk-examples.zip + S3Bucket: S3_BUCKET_TOKEN + S3Key: doea-beanstalk-examples.zip + CodeCommitS3Bucket: S3_BUCKET_TOKEN + CodeCommitS3Key: doea-beanstalk-examples.zip template: ./samples/beanstalk/pipeline.yml \ No newline at end of file diff --git a/buildspec-setup.yml b/buildspec-setup.yml index 2082a1e..bff0e46 100644 --- a/buildspec-setup.yml +++ b/buildspec-setup.yml @@ -5,21 +5,21 @@ phases: python: 3.7 commands: - python --version + pre_build: + commands: + - >- + ls -las + - chmod +x *.sh + - ./update-taskcat.sh $PIPELINE_BUCKET build: commands: - echo In buildspec-setup.yml Build started on `date` - >- - aws s3api list-buckets --query 'Buckets[?starts_with(Name, - `deoa-wkshop-abcd`) == `true`].[Name]' --output text | xargs -I {} aws s3 rb s3://{} --force - - 'sleep 10' - - 'aws s3 mb s3://deoa-wkshop-abcd' - - 'aws s3 sync . s3://deoa-wkshop-abcd' - - cd samples/ec2 - - zip deoa-ec2-examples.zip *.* - - 'aws s3 sync . s3://deoa-wkshop-abcd' - - cd ../beanstalk - - zip deoa-beanstalk-examples.zip *.* - - 'aws s3 sync . s3://deoa-wkshop-abcd' + zip -r doea-ec2-examples.zip ./samples/ec2 -j -x '*.git*' + - >- + zip -r doea-beanstalk-examples.zip ./samples/beanstalk -j -x '*.git*' + - >- + aws s3 sync . s3://$PIPELINE_BUCKET post_build: commands: - echo In buildspec-setup.yml Build completed on `date` diff --git a/pipeline-taskcat.yml b/pipeline-taskcat.yml index d59e453..41de8e2 100644 --- a/pipeline-taskcat.yml +++ b/pipeline-taskcat.yml @@ -144,7 +144,12 @@ Resources: Environment: Type: LINUX_CONTAINER ComputeType: BUILD_GENERAL1_SMALL - Image: "aws/codebuild/amazonlinux2-x86_64-standard:1.0" + Image: "aws/codebuild/amazonlinux2-x86_64-standard:3.0" + EnvironmentVariables: + - Name: PIPELINE_BUCKET + Type: PLAINTEXT + Value: + Fn::Sub: ${PipelineBucket} Source: Type: GITHUB Location: !Sub https://github.com/${GitHubUser}/${GitHubRepo}.git @@ -162,7 +167,7 @@ Resources: Environment: Type: LINUX_CONTAINER ComputeType: BUILD_GENERAL1_SMALL - Image: "aws/codebuild/amazonlinux2-x86_64-standard:1.0" + Image: "aws/codebuild/amazonlinux2-x86_64-standard:3.0" Source: Type: GITHUB Location: !Sub https://github.com/${GitHubUser}/${GitHubRepo}.git @@ -180,7 +185,7 @@ Resources: Environment: Type: LINUX_CONTAINER ComputeType: BUILD_GENERAL1_SMALL - Image: "aws/codebuild/amazonlinux2-x86_64-standard:1.0" + Image: "aws/codebuild/amazonlinux2-x86_64-standard:3.0" Source: Type: CODEPIPELINE TimeoutInMinutes: 60 @@ -196,7 +201,7 @@ Resources: Environment: Type: LINUX_CONTAINER ComputeType: BUILD_GENERAL1_SMALL - Image: "aws/codebuild/amazonlinux2-x86_64-standard:1.0" + Image: "aws/codebuild/amazonlinux2-x86_64-standard:3.0" Source: Type: CODEPIPELINE BuildSpec: !Sub | diff --git a/samples/beanstalk/pipeline.yml b/samples/beanstalk/pipeline.yml index fd7cbdd..c0e50ed 100644 --- a/samples/beanstalk/pipeline.yml +++ b/samples/beanstalk/pipeline.yml @@ -26,7 +26,7 @@ Parameters: AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. S3Key: - Description: S3 Bucket that hosts the application code + Description: Zip file that contains application code Type: String Default: html.zip AllowedPattern: "[\\x20-\\x7E]*" From 820844e149b2fcd08d73e570236722a400339fbc Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 21 Aug 2020 15:49:48 +0000 Subject: [PATCH 20/28] add update-taskcat.sh to replace S3 token --- launch-taskcat.sh | 2 +- update-taskcat.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100755 update-taskcat.sh diff --git a/launch-taskcat.sh b/launch-taskcat.sh index 5513c35..49cea4b 100755 --- a/launch-taskcat.sh +++ b/launch-taskcat.sh @@ -2,4 +2,4 @@ # sudo chmod +x *.sh # ./launch-taskcat.sh -aws cloudformation create-stack --stack-name taskcat-deoa --capabilities CAPABILITY_NAMED_IAM --disable-rollback --template-body file://pipeline-taskcat.yml +aws cloudformation create-stack --stack-name taskcat-doea --capabilities CAPABILITY_NAMED_IAM --disable-rollback --template-body file://pipeline-taskcat.yml diff --git a/update-taskcat.sh b/update-taskcat.sh new file mode 100755 index 0000000..747caad --- /dev/null +++ b/update-taskcat.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# sudo chmod +x *.sh +# ./update-taskcat.sh my-pipeline-name-bucket + +set -euo pipefail +IFS=$'\n\t' + +#/ Usage: update-taskcat.sh [PIPELINE_BUCKET] +#/ Description: Change all S3_BUCKET_TOKEN references in the TaskCat configuration file to the autogenerated S3 Bucket name used as the ArtifactStore for CodePipeline in the pipeline-taskcat.yml template. +#/ Examples: +#/ launch-stack.sh (launches a stack using the the env var PIPELINE_BUCKET, or shows you these docs if it is unset) +#/ update-taskcat.sh my-pipeline-bucket-name +#/ Options: +#/ --help: Display this help message +usage() { grep '^#/' "$0" | cut -c4- ; exit 1 ; } +expr "$*" : ".*--help" > /dev/null && usage + +readonly LOG_FILE="/tmp/$(basename "$0").log" +info() { echo "[INFO] $@" | tee -a "$LOG_FILE" >&2 ; } +warning() { echo "[WARNING] $@" | tee -a "$LOG_FILE" >&2 ; } +error() { echo "[ERROR] $@" | tee -a "$LOG_FILE" >&2 ; } +fatal() { echo "[FATAL] $@" | tee -a "$LOG_FILE" >&2 ; exit 1 ; } + +PIPELINE_BUCKET=${1:-${PIPELINE_BUCKET:-}} +if [ -z "$PIPELINE_BUCKET" ]; then + usage +fi + +echo "Running update-taskcat.sh" + +PIPELINE_BUCKET=${1:-PIPELINE_BUCKETisrequired} + +echo "$PIPELINE_BUCKET is $PIPELINE_BUCKET" + +echo "Change all S3_BUCKET_TOKEN references in the TaskCat configuration file to the autogenerated S3 Bucket name used as the ArtifactStore for CodePipeline in the pipeline-taskcat.yml template" +sed -i "s/S3_BUCKET_TOKEN/$PIPELINE_BUCKET/g" .taskcat.yml + +echo "Updated update-taskcat.sh" + +cat .taskcat.yml \ No newline at end of file From 265553132b48b79dfb97da59003f72ff0f20ed7e Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 21 Aug 2020 16:01:20 +0000 Subject: [PATCH 21/28] remove -j option --- .taskcat.yml | 2 +- buildspec-setup.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.taskcat.yml b/.taskcat.yml index 044a125..7203cfb 100644 --- a/.taskcat.yml +++ b/.taskcat.yml @@ -1,5 +1,5 @@ project: - name: deoa + name: doea regions: - us-east-1 tests: diff --git a/buildspec-setup.yml b/buildspec-setup.yml index bff0e46..d79b4ed 100644 --- a/buildspec-setup.yml +++ b/buildspec-setup.yml @@ -15,9 +15,9 @@ phases: commands: - echo In buildspec-setup.yml Build started on `date` - >- - zip -r doea-ec2-examples.zip ./samples/ec2 -j -x '*.git*' + zip -r doea-ec2-examples.zip ./samples/ec2 -x '*.git*' - >- - zip -r doea-beanstalk-examples.zip ./samples/beanstalk -j -x '*.git*' + zip -r doea-beanstalk-examples.zip ./samples/beanstalk -x '*.git*' - >- aws s3 sync . s3://$PIPELINE_BUCKET post_build: From b50d6965c079911ee13d1c729e0e01fae1b26dd3 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 21 Aug 2020 16:11:23 +0000 Subject: [PATCH 22/28] change to v5.2.0 --- samples/beanstalk/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/beanstalk/pipeline.yml b/samples/beanstalk/pipeline.yml index c0e50ed..f608011 100644 --- a/samples/beanstalk/pipeline.yml +++ b/samples/beanstalk/pipeline.yml @@ -34,7 +34,7 @@ Parameters: MySolutionStackName: Description: Name of the current solution stack name. See https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/concepts.platforms.html Type: String - Default: 64bit Amazon Linux 2 v5.1.0 running Node.js 12 + Default: 64bit Amazon Linux 2 v5.2.0 running Node.js 12 ConstraintDescription: Can contain only ASCII characters. Metadata: AWS::CloudFormation::Interface: From 24ce4f16ea2780fb89d553daa62c2fcda8de69c3 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 21 Aug 2020 20:09:48 +0000 Subject: [PATCH 23/28] run ec2 cfn test --- .taskcat.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.taskcat.yml b/.taskcat.yml index 7203cfb..fb2e189 100644 --- a/.taskcat.yml +++ b/.taskcat.yml @@ -8,13 +8,13 @@ tests: # GitHubToken: '{{resolve:secretsmanager:github/personal-access-token:SecretString}}' # SiteBucketName: delete-pmd-static-1021 # template: ./samples/static/pipeline.yml - # ec2: - # parameters: - # EmailAddress: fake-email@fake-fake-fake-email.com - # KeyName: paul-duvall-demo-us-east-1 - # CodeCommitS3Bucket: deoa-wkshop-abcd - # CodeCommitS3Key: deoa-ec2-examples.zip - # template: ./samples/ec2/pipeline.yml + ec2: + parameters: + EmailAddress: fake-email@fake-fake-fake-email.com + KeyName: '{{resolve:secretsmanager:ec2/keyname:SecretString}}' + CodeCommitS3Bucket: S3_BUCKET_TOKEN + CodeCommitS3Key: doea-ec2-examples.zip + template: ./samples/ec2/pipeline.yml beanstalk: parameters: EmailAddress: fake-email@fake-fake-fake-email.com From 2ed7a09982a1290a1a8f539f0237514285e6164a Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 21 Aug 2020 20:37:15 +0000 Subject: [PATCH 24/28] change ec2 pipeline param value to String --- samples/ec2/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/ec2/pipeline.yml b/samples/ec2/pipeline.yml index a4d990b..b701c7d 100644 --- a/samples/ec2/pipeline.yml +++ b/samples/ec2/pipeline.yml @@ -27,7 +27,7 @@ Parameters: KeyName: Description: Name of an existing Amazon EC2 key pair to enable SSH access to the instances. - Type: AWS::EC2::KeyPair::KeyName + Type: String CodeCommitS3Bucket: Description: S3 bucket that holds zip of source code for CodeCommit Repo Type: String From f8d07149bf18b267c9621abb18f31198766306d2 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Fri, 21 Aug 2020 20:54:22 +0000 Subject: [PATCH 25/28] retain S3 bucket --- samples/ec2/pipeline.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/ec2/pipeline.yml b/samples/ec2/pipeline.yml index b701c7d..eb8932a 100644 --- a/samples/ec2/pipeline.yml +++ b/samples/ec2/pipeline.yml @@ -85,7 +85,8 @@ Resources: pipeline: "$.detail.pipeline" ArtifactBucket: Type: AWS::S3::Bucket - DeletionPolicy: Delete + DeletionPolicy: Retain + UpdateReplacePolicy: Retain CodeBuildRole: Type: AWS::IAM::Role Properties: From 59613d16c51bd52a17b935e8fad01778e6327f05 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Mon, 7 Sep 2020 18:32:59 +0000 Subject: [PATCH 26/28] disable lint --- buildspec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index 0f9dfd5..2e0de31 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -15,7 +15,7 @@ phases: commands: - echo Build phase started on `date` # - taskcat test run --no-delete - - taskcat test run -k + - taskcat test run -k --lint-disable post_build: commands: - echo Build completed on `date` From e3a8adbd6d4b6d19fa5b60a297bb852632b04674 Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Wed, 31 Mar 2021 19:29:56 +0000 Subject: [PATCH 27/28] change default branch to main --- html/beanstalk-cloudformation.html | 2 +- html/ec2-cloudformation.html | 2 +- html/ecs-cloudformation.html | 2 +- samples/beanstalk/pipeline.yml | 2 +- samples/beanstalk/public/beanstalk-cloudformation.html | 2 +- samples/ec2/html/beanstalk-cloudformation.html | 2 +- samples/ec2/pipeline.yml | 2 +- samples/ecs/blue-green/pipeline.yml | 2 +- samples/ecs/pipeline.yml | 2 +- samples/ecs/templates/deployment-pipeline.yml | 2 +- samples/opsworks/html/beanstalk-cloudformation.html | 2 +- samples/opsworks/pipeline.yml | 2 +- samples/serverless/alexa/pipeline.yml | 2 +- samples/training/pipeline.yml | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/html/beanstalk-cloudformation.html b/html/beanstalk-cloudformation.html index f8325fd..cf5b797 100755 --- a/html/beanstalk-cloudformation.html +++ b/html/beanstalk-cloudformation.html @@ -49,7 +49,7 @@

Parameters

RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. S3Bucket: diff --git a/html/ec2-cloudformation.html b/html/ec2-cloudformation.html index b9a40c7..d28b206 100755 --- a/html/ec2-cloudformation.html +++ b/html/ec2-cloudformation.html @@ -55,7 +55,7 @@

Parameters

RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. TagKey: diff --git a/html/ecs-cloudformation.html b/html/ecs-cloudformation.html index 1834f9b..8d842f8 100755 --- a/html/ecs-cloudformation.html +++ b/html/ecs-cloudformation.html @@ -31,7 +31,7 @@

Parameters

RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. EmailAddress: diff --git a/samples/beanstalk/pipeline.yml b/samples/beanstalk/pipeline.yml index f608011..cde54f4 100644 --- a/samples/beanstalk/pipeline.yml +++ b/samples/beanstalk/pipeline.yml @@ -11,7 +11,7 @@ Parameters: RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. CodeCommitS3Bucket: diff --git a/samples/beanstalk/public/beanstalk-cloudformation.html b/samples/beanstalk/public/beanstalk-cloudformation.html index c1efe97..1574067 100755 --- a/samples/beanstalk/public/beanstalk-cloudformation.html +++ b/samples/beanstalk/public/beanstalk-cloudformation.html @@ -49,7 +49,7 @@

Parameters

RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. S3Bucket: diff --git a/samples/ec2/html/beanstalk-cloudformation.html b/samples/ec2/html/beanstalk-cloudformation.html index c1efe97..1574067 100755 --- a/samples/ec2/html/beanstalk-cloudformation.html +++ b/samples/ec2/html/beanstalk-cloudformation.html @@ -49,7 +49,7 @@

Parameters

RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. S3Bucket: diff --git a/samples/ec2/pipeline.yml b/samples/ec2/pipeline.yml index eb8932a..61a2c4c 100644 --- a/samples/ec2/pipeline.yml +++ b/samples/ec2/pipeline.yml @@ -10,7 +10,7 @@ Parameters: RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. TagKey: diff --git a/samples/ecs/blue-green/pipeline.yml b/samples/ecs/blue-green/pipeline.yml index ea74884..79fd19c 100644 --- a/samples/ecs/blue-green/pipeline.yml +++ b/samples/ecs/blue-green/pipeline.yml @@ -16,7 +16,7 @@ Parameters: GitHubBranch: Type: String - Default: master + Default: main Description: The branch of the repo to continuously deploy. GitHubToken: diff --git a/samples/ecs/pipeline.yml b/samples/ecs/pipeline.yml index 53f4a1d..fa5b66d 100644 --- a/samples/ecs/pipeline.yml +++ b/samples/ecs/pipeline.yml @@ -7,7 +7,7 @@ Parameters: RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. EmailAddress: diff --git a/samples/ecs/templates/deployment-pipeline.yml b/samples/ecs/templates/deployment-pipeline.yml index e88906f..c984f7b 100644 --- a/samples/ecs/templates/deployment-pipeline.yml +++ b/samples/ecs/templates/deployment-pipeline.yml @@ -2,7 +2,7 @@ Parameters: RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. EmailAddress: diff --git a/samples/opsworks/html/beanstalk-cloudformation.html b/samples/opsworks/html/beanstalk-cloudformation.html index c1efe97..1574067 100755 --- a/samples/opsworks/html/beanstalk-cloudformation.html +++ b/samples/opsworks/html/beanstalk-cloudformation.html @@ -49,7 +49,7 @@

Parameters

RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. S3Bucket: diff --git a/samples/opsworks/pipeline.yml b/samples/opsworks/pipeline.yml index 1031e91..986447e 100644 --- a/samples/opsworks/pipeline.yml +++ b/samples/opsworks/pipeline.yml @@ -11,7 +11,7 @@ Parameters: RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. Metadata: diff --git a/samples/serverless/alexa/pipeline.yml b/samples/serverless/alexa/pipeline.yml index ad7906a..1a5fe40 100644 --- a/samples/serverless/alexa/pipeline.yml +++ b/samples/serverless/alexa/pipeline.yml @@ -8,7 +8,7 @@ Parameters: RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. Resources: diff --git a/samples/training/pipeline.yml b/samples/training/pipeline.yml index 3fb62be..052dd40 100644 --- a/samples/training/pipeline.yml +++ b/samples/training/pipeline.yml @@ -15,7 +15,7 @@ Parameters: RepositoryBranch: Description: The name of the branch for the CodeCommit repo Type: String - Default: master + Default: main AllowedPattern: "[\\x20-\\x7E]*" ConstraintDescription: Can contain only ASCII characters. TagKey: From bcb2de746d4fd6168bad3c8727365facc0b3e0fa Mon Sep 17 00:00:00 2001 From: Paul Duvall Date: Wed, 31 Mar 2021 19:43:44 +0000 Subject: [PATCH 28/28] change default branch to main --- samples/beanstalk/public/ec2-cloudformation.html | 2 +- samples/ec2/html/ecs-cloudformation.html | 2 +- samples/ec2/html/opsworks-cloudformation.html | 2 +- samples/ec2/html/serverless-cloudformation.html | 2 +- samples/ecs/blue-green/pipeline.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/samples/beanstalk/public/ec2-cloudformation.html b/samples/beanstalk/public/ec2-cloudformation.html index 9d32c68..e820307 100755 --- a/samples/beanstalk/public/ec2-cloudformation.html +++ b/samples/beanstalk/public/ec2-cloudformation.html @@ -56,7 +56,7 @@

Parameters

"RepositoryBranch":{ "Description":"The name of the branch for the CodeCommit repo", "Type":"String", - "Default":"master", + "Default":"main", "AllowedPattern":"[\\x20-\\x7E]*", "ConstraintDescription":"Can contain only ASCII characters." }, diff --git a/samples/ec2/html/ecs-cloudformation.html b/samples/ec2/html/ecs-cloudformation.html index 7e801dc..269ecc4 100755 --- a/samples/ec2/html/ecs-cloudformation.html +++ b/samples/ec2/html/ecs-cloudformation.html @@ -57,7 +57,7 @@

Parameters

"RepositoryBranch":{ "Description":"The name of the branch for the CodeCommit repo", "Type":"String", - "Default":"master", + "Default":"main", "AllowedPattern":"[\\x20-\\x7E]*", "ConstraintDescription":"Can contain only ASCII characters." }, diff --git a/samples/ec2/html/opsworks-cloudformation.html b/samples/ec2/html/opsworks-cloudformation.html index fddb170..f863ff6 100755 --- a/samples/ec2/html/opsworks-cloudformation.html +++ b/samples/ec2/html/opsworks-cloudformation.html @@ -56,7 +56,7 @@

Parameters

"RepositoryBranch":{ "Description":"The name of the branch for the CodeCommit repo", "Type":"String", - "Default":"master", + "Default":"main", "AllowedPattern":"[\\x20-\\x7E]*", "ConstraintDescription":"Can contain only ASCII characters." } diff --git a/samples/ec2/html/serverless-cloudformation.html b/samples/ec2/html/serverless-cloudformation.html index 3d742aa..032120a 100755 --- a/samples/ec2/html/serverless-cloudformation.html +++ b/samples/ec2/html/serverless-cloudformation.html @@ -57,7 +57,7 @@

Parameters

"RepositoryBranch":{ "Description":"The name of the branch for the CodeCommit repo", "Type":"String", - "Default":"master", + "Default":"main", "AllowedPattern":"[\\x20-\\x7E]*", "ConstraintDescription":"Can contain only ASCII characters." }, diff --git a/samples/ecs/blue-green/pipeline.yml b/samples/ecs/blue-green/pipeline.yml index 79fd19c..ea74884 100644 --- a/samples/ecs/blue-green/pipeline.yml +++ b/samples/ecs/blue-green/pipeline.yml @@ -16,7 +16,7 @@ Parameters: GitHubBranch: Type: String - Default: main + Default: master Description: The branch of the repo to continuously deploy. GitHubToken: