Articles → AWS → Parameters In AWS CloudFormation

Parameters In AWS CloudFormation






Purpose





Create A YAML File




AWSTemplateFormatVersion: "2010-09-09"
Description: Create an S3 bucket with a parameter for the bucket name.

Parameters:
  BucketName:
    Type: String
    Description: The name of the S3 bucket to create.
    MinLength: 3
    MaxLength: 6
    AllowedPattern: '^[a-z0-9.-]*$'
    ConstraintDescription: "Bucket name must only contain lowercase letters, numbers, periods, and hyphens."

Resources:
  MyS3Bucket:
    Type: 'AWS::S3::Bucket'
    Properties:
      BucketName: !Ref BucketName





Create A Stack




Picture showing creating a Cloudformation stack with parameters




Picture showing the error message when constraint rule is not followed



Posted By  -  Karan Gupta
 
Posted On  -  Thursday, January 30, 2025

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250