Resource

The resource method maps to the CloudFormation Template Anatomy Resources section.

Example Snippets

# short form
resource("Instance", "AWS::EC2::Instance",
  InstanceType: ref("InstanceType"),
  ImageId: ref("ImageId"),
)

# medium form
resource("SecurityGroup",
  Type: "AWS::EC2::SecurityGroup",
  Properties: {
    GroupDescription: "demo security group"
  }
)

# long form
resource("SnsTopic" => {
  Type: "AWS::SNS::Topic",
  Properties: {
    Description: "my topic desc",
    DisplayName: "my topic name",
  }
})

Example Outputs

Resources:
  Instance:
    Type: AWS::EC2::Instance
    Properties:
      InstanceType:
        Ref: InstanceType
      ImageId:
        Ref: ImageId
  SecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: demo security group
  SnsTopic:
    Type: AWS::SNS::Topic
    Properties:
      Description: my topic desc
      DisplayName: my topic name

Back to DSL List Docs.

Pro tip: Use the <- and -> arrow keys to move back and forward.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!