rbalman / cfn-compose Goto Github PK
View Code? Open in Web Editor NEWcompose your cloudformation stacks like docker compose
License: MIT License
compose your cloudformation stacks like docker compose
License: MIT License
Summary
The number of concurrent go routines spun at the moment is directly related with number of flows being sent in the configuration. Example below configuration spins two go routines as there are two flows in the configuration. The internal logic of the spinning the go routine is, details here:
//Generate the worker pool as pre the flow counts
for i := 0; i < len(cc.Flows); i++ {
go executeFlow(ctx, cfnTask, resultsChan, i)
}
Example
....
Flows:
DemoSQS:
<<: *default
Description: Creates Demo SQS Queue
Stacks:
- template_file: sqs.yml
stack_name: demo-{{ .ENV_NAME }}-sqs-queue
Order: 0
tags:
type: "sqs"
DemoRDSInstance:
<<: *default
Description: Demo RDS Instance
Stacks:
- template_file: rds.yml
stack_name: demo-{{ .ENV_NAME }}-rds-instance
Order: 0
parameters:
EngineVersion: '12.4.0'
Acceptance Criteria:
When running cfnc:
Summary
If we deploy massive amount of the CloudFormation stacks concurrently then we might encounter rate throttle limits like below:
Acceptance Criteria:
In the scope of this issue we would like to see:
rate throttle issue
starts to appearAWS SDK configuration
or make changes on our side to introduce retry mechanismSonarCloud enables team to deliver clean code consistently and efficiently with a tool that easily integrates into the cloud DevOps platforms and extend your CI/CD workflow.
Integration PR: #8
Right now the sample configuration looks sth like shown below where we are not sure if we can make use of defaults and override any specific configuration from individual flow. The scope of the issue is to:
Current Status
Description: Demo CloudFormation Compose file
Vars:
ENV_NAME: demo
ENV_TYPE: nonproduction
AWS_PROFILE: demo
Flows:
DemoSQS:
Description: Creates Demo SQS Queue
Stacks:
- template_file: sqs.yml
stack_name: demo-{{ .ENV_NAME }}-sqs-queue
parameters:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
tags:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
Order: 0
DemoRDSInstance:
Description: Demo RDS Instance
Stacks:
- template_file: rds.yml
stack_name: demo-{{ .ENV_NAME }}-rds-instance
parameters:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
tags:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
Order: 0
DemoEc2Instance:
Description: Deploy Demo EC2 Instance
Stacks:
- template_file: ec2.yml
stack_name: demo-{{ .ENV_NAME }}-ec2-instance
parameters:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
tags:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
Order: 1
Expected
Description: Demo CloudFormation Compose file
Vars:
ENV_NAME: demo
ENV_TYPE: nonproduction
AWS_PROFILE: demo
default: &default
parameters:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
tags:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
Flows:
DemoSQS:
<<: *default
Description: Creates Demo SQS Queue
Stacks:
- template_file: sqs.yml
stack_name: demo-{{ .ENV_NAME }}-sqs-queue
Order: 0
tags:
type: "sqs"
DemoRDSInstance:
<<: *default
Description: Demo RDS Instance
Stacks:
- template_file: rds.yml
stack_name: demo-{{ .ENV_NAME }}-rds-instance
Order: 0
parameters:
EngineVersion: '12.4.0'
DemoEc2Instance:
<<: *default
Description: Deploy Demo EC2 Instance
Stacks:
- template_file: ec2.yml
stack_name: demo-{{ .ENV_NAME }}-ec2-instance
Order: 1
Workflow is pending manual review.
URL: https://github.com/BalmanRawat/cfn-deploy/actions/runs/2713494923
Required approvers: [balmanrawat]
Respond "approved", "approve", "lgtm", "yes" to continue workflow or "denied", "deny", "no" to cancel.
Summary
Right now to run the cfnc command either you need to install Golang
and compile or install the compiled cfnc binary. Both of them might not be the right choice if you don't want to install and run it as a docker container.
In the scope of this story:
eg. outcome: the help command should work as below
docker run cfnc --help
Manage cloudformation stacks at scale. Design and deploy multiple cloudformation stacks either in sequence or in prallel using declarative configuration
Usage:
cfnc [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
config Generate, validate and visualize the compose configuration
deploy Deploys the stacks based on the sequence specified in the compose configuration
destroy Destroys all the stacks in the reverse order of creation
help Help about any command
Flags:
-c, --config string File path to compose file (default "cfn-compose.yml")
-d, --dry-run Run commands in dry run mode
-h, --help help for cfnc
-l, --loglevel string Specify Log Levels. Valid Levels are: DEBUG, INFO, WARN, ERROR (default "INFO")
-v, --version version for cfnc
Use "cfnc [command] --help" for more information about a command.
The installation instructions at Readme should include:
Workflow is pending manual review.
URL: https://github.com/BalmanRawat/cfn-deploy/actions/runs/2713527779
Required approvers: [balmanrawat]
Respond "approved", "approve", "lgtm", "yes" to continue workflow or "denied", "deny", "no" to cancel.
Workflow is pending manual review.
URL: https://github.com/BalmanRawat/cfn-deploy/actions/runs/2713527779
Required approvers: [balmanrawat]
Respond "approved", "approve", "lgtm", "yes" to continue workflow or "denied", "deny", "no" to cancel.
When things are declarative, things become configuration heavy. It will always be better and productive if we can play with config options by validating, listing the dependencies.
Summary
Example Compose file:
Description: Sample CloudFormation Compose file
Vars:
ENV_NAME: cfn-compose
ENV_TYPE: nonproduction
SUBNET_ID: "subnet-033274e18559e7bde"
VPC_ID: "vpc-0001e3b703212c9cb"
Flows:
SecurityGroup:
Order: 0
Description: Creates Security Group
Stacks:
- template_file: sg.yml
stack_name: sample-{{ .ENV_NAME }}-security-group
parameters:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
VpcId: '{{ .VPC_ID }}'
tags:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
EC2Instance:
Order: 1
Description: Deploying EC2 Instance
Stacks:
- template_file: ec2.yml
stack_name: sample-{{ .ENV_NAME }}-ec2-instance
parameters:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
SubnetId: '{{ .SUBNET_ID }}'
tags:
EnvironmentName: '{{ .ENV_NAME }}'
EnvironmentType: '{{ .ENV_TYPE }}'
Right now we use vars
section in the cfn-compose.yml
file to supply go template variables and replace with them dynamically in the rest of the template configuration. Since the template and variables are declared in the same template we need to parse cfn-compose.yml
file twice.
It might be better to separate vars section
as a separate file to have better control, extensibility and independence for future use cases.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.