User Tools

Site Tools


aws:aws-cloudformation-parameters-mappings-refs

Parameters, Mappings, and !Refs

Parameters

---
Parameters:
    ParameterTest:
        Type: String
        Description: Enter t2.micro, m1.small, or m1.large. Default is t2.micro.

Resources:
  BasicParameter:
    Type: AWS::SSM::Parameter
    Properties:
      Name: AJS-testPara
      Type: String
      Value: !Ref ParameterTest
      Description: SSM Parameter test.
      Tags:
        Environment: DEV

Mappings

---
Parameters:
  Environment:
    Description: Environment parameters
    Type: String
    Default: Development
    AllowedValues:
      - Production
      - Development
Mappings:
  AMIRegions_Map:
    eu-west-1:
      Development: ami-123456
      Production:  ami-654321
    eu-west-2:
      Development: ami-123321
      Production:  ami654456
    us-east-1:
      Development: ami-321123
      Production:  ami456456
Resources:
  WebEC2Instance:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: !FindInMap [AMIRegions_Map, !Ref "AWS::Region", !Ref Environment]
      InstanceType: t2.micro

Passing parameters in to a cloudformation file

Declare Variables in Parameters section of CF script

---
Parameters:
    VPCName:
        Type: String
        Description: VPC Name for test.

Resources:
  BasicParameter:
    Type: AWS::SSM::Parameter
    Properties:
      Name: AJS-test-VPC-Name
      Type: String
      Value: !Ref VPCName
      Description: SSM Parameter test.
      Tags:
        Environment: Test
#!/bin/bash
 
aws cloudformation create-stack \
        --stack-name Stack1 \
        --template-body file://stack1.yaml \
        --capabilities CAPABILITY_NAMED_IAM \
        --parameters \
                ParameterKey=VPCName,ParameterValue=MyVPC

This page has been accessed for:-
Today: 1
Yesterday: 0
Until now: 106

aws/aws-cloudformation-parameters-mappings-refs.txt · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki