Skip to content

Latest commit

 

History

History
210 lines (132 loc) · 9.61 KB

cli-reference.md

File metadata and controls

210 lines (132 loc) · 9.61 KB

org-formation cli reference

In general: org-formation needs to be ran in the context of the organization master account. The IAM account needs to be broadly provisioned (happy to specify what in more detail)

Typing help after any command in the commandline will print documentation.

Operations on organization resources

org-formation init

Creates a local organization formation file that contains all organization resources. Running this command will create an S3 Bucket (hence the region) in your account that contains a state file which is used to track differences when updating your resources.

> org-formation init --region us-east-1

note: at any time you should be able to delete the state bucket and start over using the init command above.

option default description
--region none The --region used to create the S3 bucket used to store state

org-formation init-pipeline

Creates an organization as done using the init command as well as default CodeCommit, CodeBuild and CodePipeline resources. The initial commit will contain the organization file generated for your organization as well as a default tasks-file.

> org-formation init-pipeline --region us-east-1

note: at any time you should be able to run this command and start using the pipeline.

option default description
--region none The --region used to create the AWS resources
--stack-name organization-formation-build The name of the stack used to create the CodeCommit, CodeBuild and CodePipeline resources.
--resource-prefix orgformation- A prefix used for the CodeBuild and CodePipeline resources.
--repository-name organization-formation Name of the CodeCommit resource that will host the org-formation files.

org-formation update

Updates organizational resources specified in templateFile.

> org-formation update organization.yml

org-formation create-change-set

Creates a changeset that can be reviewed and later applied for changes in templateFile.

> org-formation create-change-set organization.yml

output will contain the changeset as well as the changeset name.

option default description
--change-set-name random value Name of the changeset that can later be used to apply changes.

org-formation execute-change-set

Execute a changeset by name of changeSetName.

> org-formation execute-change-set change-set-name

Operations on stacks

org-formation update-stacks

Will deploy CloudFormation resources specified in templateFile.

> org-formation update-stacks template.yml --stack-name my-stack

option default description
--stack-name none required
The stack name used to deploy CloudFormation resources
--parameters none parameters that need to be passed to the CloudFormation template.
--termination-protection false If specified the stack will be created with termination protection.
--update-protection false When set to true will create a StackPolicy for the stacks that prevents any resource from being modified through CloudFormation.
--max-concurrent-stacks 1 Maximum number of stacks to be updated concurrently
--failed-stacks-tolerance 0 The number of failed stacks after which execution stops

parameters can be passed in a similar fashion CloudFormation parameters are passed: > org-formation update-stacks template.yml --stack-name my-stack --parameters ParameterKey=Param1,ParameterValue=Val1 ParameterKey=Param2,ParameterValue=Val2

or the somewhat more simple fashion: > org-formation update-stacks template.yml --stack-name my-stack --parameters Param1=Val1 Param2=Val2

org-formation validate-stacks

validates the CloudFormation templates that will be generated based on templateFile.

> org-formation validate-stacks template.yml --stack-name my-stack

option default description
--stack-name 'validation' The stack name used to deploy CloudFormation resources (used in e.g. generated names for output)
--parameters none parameters that need to be passed to the CloudFormation template.

parameters can be passed in a similar fashion CloudFormation parameters are passed: > org-formation validate-stacks template.yml --stack-name my-stack --parameters ParameterKey=Param1,ParameterValue=Val1 ParameterKey=Param2,ParameterValue=Val2

or the somewhat more simple fashion: > org-formation validate-stacks template.yml --stack-name my-stack --parameters Param1=Val1 Param2=Val2

org-formation print-stacks

Will print out CloudFormation templates generated based on templateFile.

> org-formation update-stacks template.yml --stack-name my-stack

option default description
--stack-name 'print' The stack name used to deploy CloudFormation resources (used in e.g. generated names for output)
--parameters none parameters that need to be passed to the CloudFormation template.

org-formation describe-stacks

Lists all stacks deployed to accounts using org-formation

> org-formation describe-stacks

option default description
--stackName none If specified will limit the output to changeset with specified stack name

> org-formation execute-change-set change-set-name

org-formation delete-stacks

Will delete all stacks of name stackName that have been deployed using org-formation.

> org-formation delete-stacks stackName

option default description
--max-concurrent-stacks 1 Maximum number of stacks to be deleted concurrently
--failed-stacks-tolerance 0 The number of failed stacks after which execution stops

Note: Want to review the stacks that will be deleted? use describe-stacks

Operations on task files

org-formation perform-tasks

Will perform tasks from tasksFile.

> org-formation perform-tasks tasks.yml

option default description
--logical-name 'default' logical name of the tasks file, allows multiple taskfiles to be used together with --perform-cleanup action
--organization-file undefined path to the organization file that will be used to evaluate organizational bindings
--perform-cleanup false when set will cleanup resources created by previous perform-tasks after task is removed from tasks file
--parameters none parameter values that need to be used when processing the taskfile.
--max-concurrent-tasks 1 Maximum number of tasks to be executed concurrently
--failed-tasks-tolerance 0 The number of failed tasks after which execution stops
--max-concurrent-stacks 1 Maximum number of stacks (within a task) to be executed concurrently
--failed-stacks-tolerance 0 The number of failed stacks (within a task) after which execution stops

Parameters can be passed using the following syntax: > org-formation perform-tasks taskfile.yml --parameters Param1=Val1 Param2=Val2

org-formation validate-tasks

Will validate the tasks-file, including configured tasks.

> org-formation validate-tasks tasks.yml

option default description
--organization-file undefined path to the organization file that will be used to evaluate organizational bindings

Global options

option default description
--profile none The --profile option works just like the --profile option in the AWS cli. If no profile is specified it uses the default profile from your ~/.aws/config file
--state-bucket-name organization-formation-${AWS::AccountId} The --state-bucket-name option allows you to specify which S3 Bucket state needs to be stored. The name may contain ${AWS::AccountId}.
--state-object state.json The --state-object option allows you to specify which S3 object state needs to be stored in.
--no-color the --no-color option will toggle off colorization of log files.
--print-stack the --print-stack option will log stack traces for errors that occur.
--verbose the --verbose option will log debug level information.