Skip to content

Instantly share code, notes, and snippets.

@pbzona
Created November 21, 2017 20:56
Show Gist options
  • Save pbzona/e9a21dc37b3c0019a3f64bb44483cb3c to your computer and use it in GitHub Desktop.
Save pbzona/e9a21dc37b3c0019a3f64bb44483cb3c to your computer and use it in GitHub Desktop.
CloudFormation - Declarative code example in YAML
Parameters:
LargerInstance:
Description: Whether a larger instance should be used
Default: false
Type: String
AllowedValues: [true, false]
Resources:
EC2Instance:
   Type: AWS::EC2::Instance
   Properties:
     InstanceType:
       !If [UseLargerInstance, m4.large, t2.micro]
     KeyName: 'default' # keypair must already exist
     ImageId: ami-8c1be5f6 # AMI us-east-1
Conditions:
UseLargerInstance: !Equals [true, !Ref LargerInstance]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment