With Lono, you write your CloudFormation template with a DSL. The DSL is actually just Ruby code. This means we get the full power of a programming language. We can use loops, define methods, modules, etc. At the same time, the Lono DSL stays very close to the declarative nature of CloudFormation. We get the best of both worlds.

Here’s an example of what the DSL looks like.


description "Demo stack"

parameter("InstanceType", "t3.micro")

  "us-east-1": { Ami: "ami-0de53d8956e8dcf80" },
  "us-west-2": { Ami: "ami-061392db613a6357b" }

resource("Instance", "AWS::EC2::Instance",
  InstanceType: ref("InstanceType"),
  ImageId: find_in_map("AmiMap", ref("AWS::Region"), "Ami"),
  SecurityGroupIds: [get_att("SecurityGroup.GroupId")],
  UserData: base64(user_data("bootstrap.sh"))
resource("SecurityGroup", "AWS::EC2::SecurityGroup",
  GroupDescription: "demo security group",

output("SecurityGroup", get_att("SecurityGroup.GroupId"))