- Newest
- Most votes
- Most comments
Hello.
The following document contains an example of command execution that specifies an SSM document.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/service_code_examples.html#create-stack-sdk
The following create-stack command creates a stack with the name myteststack using an AWS Systems Manager document for the template URL.
aws cloudformation create-stack --stack-name myteststack \
--template-url "ssm-doc://arn:aws:ssm:us-east-1:123456789012:document/documentName"
To call the CloudFormation CreateStack operation using a Systems Manager document (of type CloudFormation) as the template, you can use the Systems Manager document ARN in the TemplateURL parameter. The format for specifying a Systems Manager document as the template URL is:
"ssm-doc://arn:aws:ssm:region:account-id:document/documentName"
Here's an example of how you would use this in an AWS CLI command:
aws cloudformation create-stack --stack-name myteststack --template-url "ssm-doc://arn:aws:ssm:us-east-1:123456789012:document/documentName"
This format allows CloudFormation to retrieve the template content from the specified Systems Manager document. Make sure that the document you're referencing is of type CloudFormation template and that you have the necessary permissions to access it.
When using this method, you don't need to upload your template to an S3 bucket first, which can simplify your workflow, especially if you're already managing your CloudFormation templates as Systems Manager documents.
Remember that the Systems Manager document containing your CloudFormation template must be in the same AWS region where you're creating the stack. Also, ensure that your IAM permissions allow both access to the Systems Manager document and the ability to create CloudFormation stacks.
Sources
Examples of CloudFormation stack operation commands for the AWS CLI and PowerShell - AWS CloudFormation
AWS Systems Manager Documents - AWS Systems Manager
CreateStack - AWS CloudFormation
Relevant content
asked 3 years ago
asked 2 years ago
