Name: aws-codepipeline-time-windows
Owner: AWS Samples
Description: Use this sample to create required resources for building time window or black days based approvals in AWS CodePipeline.
Created: 2016-11-24 07:04:41.0
Updated: 2017-12-29 21:21:49.0
Pushed: 2017-01-05 22:14:27.0
Homepage: null
Size: 14
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
The resources in this repository will help you setup required AWS resources for building time window and black days based approvals in AWS CodePipeline.
aws-codepipeline-time-windows
.Run following steps in the local workspace where GitHub repository was cloned:
If you chose a different AWS CodeCommit repository name, replace ParameterValue
in setup-time-window-resources-stack-parameters.json
file with the name you chose.
Update time-window-demo-resources-parameters.json
file to replace parameter values:
CodeDeploySampleAppS3BucketName
: Amazon S3 bucket name from step 4 in Prerequisites section.CodeDeploySampleAppS3ObjectKey
: The object key from step 4 in Prerequisites section.TimeWindowConfiguration
: Time window configuration which specifies window opening and closing times (UTC), and black day dates in JSON string format. It contains following properties:window
: Specifies opening (opens
) and closing time (closes
) of the time window in hours (0-24) in UTC.blackDayDates
: A list of dates in ISO format where no approvals are to be given for the full day. This can include important days where peak traffic is expected.KeyPairName
: Amazon EC2 key pair name.YourIP
: IP address to connect to SSH from. Check http://checkip.amazonaws.com/ to find yours.Create a new CloudFormation stack using AWS CloudFormation template setup-time-window-resources-stack.yml
and parameter file setup-time-window-resources-stack-parameters.json
. See this article for the details on how to pass parameters file using CLI.
cloudformation create-stack --stack-name SetupTimeWindowDemoResourcesStack --template-body file://<The path to local workspace>/aws-codepipeline-time-windows/setup-time-window-resources-stack.yml --capabilities CAPABILITY_IAM --parameters file://<The path to local workspace>/aws-codepipeline-time-windows/setup-time-window-resources-stack-parameters.json
Step 3 will create an AWS CodePipeline named SetupTimeWindowsDemoResources-Pipeline
. This pipeline will use AWS CloudFormation integration with AWS CodePipeline to publish AWS Lambda functions to Amazon S3 and create a new stack using template time-window-demo-resources.yml
that contains actual AWS resources used in demo including a new AWS CodePipeline named TimeWindowsDemoPipeline
.
Above step will set up following things:
TimeWindowsDemoPipeline
with a stage that contains Approval and AWS CodeDeploy actions. Approval action specifies an Amazon SNS topic to which notifications are sent when this action runs.register-time-window.js
) is subscribed to this topic which registers this request in an Amazon DynamoDB table.process-time-windows.js
) that runs periodically and scans the table for open approval requests. If the current time is open as per time window configuration specified in TimeWindowsDemoPipeline
pipeline, it approves the request using AWS CodePipeline API PutApprovalResult
which allows the pipeline run to proceed to the next AWS CodeDeploy stage.When no longer required, please remember to delete the stacks using AWS CloudFormation console or CLI to avoid getting charged.
This plugin is open sourced and licensed under Apache 2.0. See the LICENSE file for more information.