CyberKeeda In Social Media
Showing posts with label CloudFormation Parameters. Show all posts
Showing posts with label CloudFormation Parameters. Show all posts

AWS CloudFormation Psuedo Parameters




AWS Cloud Formation Pseudo Parameters.


Parameters section within CloudFormation template is way to gather inputs from user, which can be used within other sections of entire cloudformation script.

Pseudo Parameter
  • Type of parameters that are predefined by AWS Cloudformation.
  • We don't need to declare it within our template section.
  • Can be used the same way normal parameters are used via !Ref as an argument.
Usage Examples.

"AWS::Region" is one of the widely used Pseudo parameters, so below is the way we can use it under our CFN template.


CFN Output Section
Outputs:
  MyStacksRegion:
    Value: !Ref "AWS::Region"


CFN Mappings Section
Resources:
  CreateEC2Instance:
    Type: "AWS::EC2::Instance"
    Properties:
      ImageId: !FindInMap
      - ImageIdMap
      - !Ref !Ref "AWS::Region"
      - defaultAMI

So in the same there are few more pseudo parameters enlisted below.

AWS::AccountId
  • Returns the account id from where the stack is being created.
AWS::NotificationARNs
  • Returns the list of notification Amazon Resource Names (ARNs) for the current stack
AWS::NoValue
  • Removes the corresponding resource property when specified as a return value in the Fn::If intrinsic function.
AWS::Partition
  • Returns the partition that the resource is in. For standard AWS regions, the partition is aws. For resources in other partitions, the partition is aws-partitionname
AWS::Region
  • Return where the stack is being created, example ap-south-1
AWS::StackId
  • Returns the ID of the stack as specified with the aws cloudformation create-stack command, such as arn:aws:cloudformation:ap-south-1:123456789987:stack/cyberkeedastack/90af3dc0-d9a7-01e4-972e-1234567se123.
AWS::StackName
  • Returns the name of the stack as specified with the aws cloudformation create-stack command, such as cyberkeedastack.
AWS::URLSuffix
  • Returns the suffix for a domain. The suffix is typically amazonaws.com, but might differ by region.

Read more ...

AWS CloudFormation : AWS Specific Parameter Types



AWS Cloud Formation Parameters.


Parameters section within CloudFormation template is way to gather inputs from user, which can be used within other sections of entire cloudformation script.

Parameter Type
Parameter Type plays a very important, it enable CloudFormation to validate inputs earlier in the stack creation process, thus it is a way cloudformation can validate your input based upon type before even instantiating stack creation.

Here are the valid Parameter types supported by AWS CloudFormation

TypeDetails
String Can be used to validate normal string.
Number FAn integer or float
List<Number>RAn array of integers or floats
CommaDelimitedListHAn array of literal strings that are separated by commas
List<AWS::EC2::SecurityGroup::Id>Array of security group IDs
AWS::EC2::KeyPair::KeyNameAn Amazon EC2 key pair name
AWS::EC2::SecurityGroup::IdA security group ID
AWS::EC2::Subnet::Idsubnet ID
AWS::EC2::VPC::IdVPC ID
List<AWS::EC2::VPC::IdAn array of VPC IDs
List<AWS::EC2::Subnet::Id>An array of subnet IDs

Parameter section Example.



Parameters:
  EnvironmentName:
    DescriptionSelect the environment.
    TypeString
    Defaultdev
    AllowedValues:
      - dev
      - prd
  EC2InstanceType:
    TypeString
    Defaultt2.micro
    AllowedValues:
        - t2.micro
        - t2.small
  EC2KeyName:
    DescriptionSelect your Key name from List.
    TypeAWS::EC2::KeyPair::KeyName




Read more ...
Designed By Jackuna