I need to point my users to a cloudformation stack that they will need to run, but I'd like to be able to personalize it based on the user. I've read this and I would like to create a URL like:
https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=SomeName&MyParam=blah&templateURL=https://s3.amazonaws.com/mytemplate.json
Notice the "MyParam=blah" in the middle. The user can still change the parameter to whatever they want, but I'd like to be able to set a default. Any ideas, other than writing a custom Cloudformation template per user?
Referencing a parameter within a template You use the Ref intrinsic function to reference a parameter, and AWS CloudFormation uses the parameter's value to provision the stack. You can reference parameters from the Resources and Outputs sections of the same template.
In the AWS CloudFormation console , from the list of stacks, select the running stack that you want to update. In the stack details pane, choose Update. If you haven't modified the stack template, select Use current template, and then choose Next.
Pseudo parameters are parameters that are predefined by AWS CloudFormation. You don't declare them in your template. Use them the same way as you would a parameter, as the argument for the Ref function.
The new per template limits for the maximum number of resources is 500 (previously 200), parameters is 200 (previously 60), mappings is 200 (previously 100), and outputs is 200 (previously 60). CloudFormation allows you to model and provision cloud resources as code in a safe, predictable, and scalable manner.
[Update]: As of Jul 14 2017, it is now possible to specify template parameters in URL query parameters provided to the launch stack URL. Use the param_parameterName
format to specify template parameters, e.g.:
https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/review?stackName=SomeName¶m_MyParam=blah&templateURL=https://s3.amazonaws.com/mytemplate.json
See Creating Quick-Create Links for Stacks for full details.
[Original answer, Feb 10 2017]:
It is not possible to preset default parameters directly via an AWS CloudFormation launch URL. stackName
and templateURL
are the only two URI fragment components that are parsed by the JavaScript code executed on this page.
Refer to the current CloudFormation Console JavaScript source to confirm this, specifically the parseRouteParams
function in the StackInfo
object used by the CreateStackController
:
this.parseRouteParams = function(a) {
a = _.reduce(a, function(a, b, d) {
a[d] = decodeURIComponent(b);
return a
}, a);
_.extend(this, _.pick(a, "stackName", "templateURL"))
}
Here are some other ideas:
Default
value of a Property in your CloudFormation template based on a provided query parameter, uploads the rendered template to an S3 bucket, then redirects to the create-stack page providing the URL to the newly-rendered template.create-stack
, or build your own web interface to dynamically provide default parameters.You can use our new quick launch URL to supply parameters to the Cloudformation Console. It supports Parameters using param_Foo syntax.
Here is an example for a sample APP
https://eu-central-1.console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/create/review?templateURL=https://s3-eu-central-1.amazonaws.com/cloudformation-templates-eu-central-1/WordPress_Single_Instance.template&stackName=MyWPBlog¶m_DBName=mywpblog¶m_InstanceType=t2.medium¶m_KeyName=MyKeyPairUSEast1
Please note that this does not support deep linking for No Echo parameters, by design.
More info: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-console-create-stacks-quick-create-links.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With