Ludwig Tutorial 4: Route Table

This tutorial is actually a Ludwig composition. You can download it here and fugue run it like you would any other composition. You can use lwc, the Ludwig compiler, to compile the composition.

If you’re interested in text editor plug-ins, you can find them here. Click here to return to the Tutorial table of contents.


Let’s Go!

We’ll begin with the work from the last tutorial.


import Fugue.AWS as AWS
import Fugue.AWS.EC2 as EC2

my-vpc: {
  cidrBlock: "",
  region: AWS.Us-west-2

subnet1: {
  cidrBlock: '',
  vpc: my-vpc,
  availabilityZone: AWS.A,
  mapPublicIpOnLaunch: True

my-igw: {
  vpc: my-vpc

Here, a route table is added.

route-table: {
  vpc: my-vpc,
  routes: [

Lists in Ludwig are homogenous. Values can either be literals, or functions that return a value of the same type as the rest in the list, just like a binding. Therefore, this function call in the middle of a list is perfectly valid. {
  destinationCidrBlock: "",

This is a positional argument function. Idiomatic Ludwig only uses this notation for single-argument functions (with the exception proving the rule being the tag function). The function shown here takes an internet gateway value, performs some validation, and returns a route target.

      target: EC2.GatewayTarget(my-igw)
  associations: [subnet1]

Running and Compiling the Composition

You can run this composition with the following command:

fugue run Tutorial4.lw

This will create the following infrastructure in your AWS account:

  • VPC
  • Subnet
  • Internet gateway
  • Route table

Optionally, if you have a process running from previous tutorials, you can simply update the process like this:

fugue update [ALIAS or FID] Tutorial4.lw

To just check compilation, invoke lwc, the Ludwig compiler:

lwc Tutorial4.lw