Skip to main content
In this lesson you’ll learn how to define CloudFormation Parameters to accept input, set sensible defaults, and constrain user choices. Parameters act as template inputs (form fields) and support validation through Type, Default, AllowedValues, and other properties. You’ll also see how to reference parameters (with !Ref or Ref) inside resources such as an S3 bucket. Parameters are useful for:
  • Reusing templates across environments (dev/stage/prod).
  • Pre-filling metadata like developer names or tags.
  • Restricting choices to avoid invalid configurations.
Parameters overview A parameter entry defines the input name, its Type, and optional validation and UI hints such as Description, Default, and AllowedValues. These fields enforce validation both in the console and when you run linting tools locally. Useful references: Simple example — referencing a parameter in an S3 bucket Below is a minimal template that defines a parameter for the S3 bucket name and uses it in the bucket resource via !Ref:
Setting a default value Providing a Default value pre-fills the parameter in the CloudFormation console so users don’t need to type the same metadata repeatedly. Defaults are especially handy for tags such as Developer or Environment. Example: add a developer parameter with a Default and use it in the bucket Tags via !Ref.
Validate your template locally before uploading:
Use cfn-lint to catch syntax errors, unsupported properties, or policy issues before deploying—this can save time and reduce failed stack updates.
When you upload this template and choose Update stack → Replace existing template, CloudFormation will show the parameters page with the Default value pre-filled. The Default will be used unless you overwrite it in the console.
Screenshot of the AWS CloudFormation "Specify stack details" page. It shows parameter fields with InputBucketName set to "eden-kodekloud-bncv-bkt" and InputDeveloperName set to "Arno."
Limiting choices with AllowedValues To present a curated set of options to users (for example, a list of developers or environments), use AllowedValues. The CloudFormation console renders a dropdown containing only the specified values.
CloudFormation often displays the first AllowedValues entry as the initially-selected value in the dropdown. Be mindful of the ordering if you rely on which option is selected by default.
To update the stack with the modified template, choose Update stack → Replace existing template and upload the updated file.
A screenshot of the AWS CloudFormation "Update stack" page showing the stepper on the left and the "Prerequisite - Prepare template" section in the center. The "Replace existing template" option is selected among choices to use or edit the stack template.
After you select an AllowedValues entry and apply the update, CloudFormation passes that value to the parameter and the resource tags reflect the chosen developer. If the S3 console doesn’t immediately show the updated tags, try a hard refresh of the page. Summary — quick takeaways
  • Default: pre-fills a parameter value in the CloudFormation console to simplify deployments.
  • AllowedValues: restricts a parameter to a predefined set of valid choices and produces a dropdown in the console.
  • Reference parameters in resources using !Ref (or other intrinsic functions) to populate properties such as BucketName or Tags.
  • Validate templates locally with tools like cfn-lint before uploading.
Final example (parameters with AllowedValues and the referenced S3 resource):
Further reading and references

Watch Video