Ludwig Tutorial 3: Internet Gateway

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.

Ready?

Let’s Go!

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

composition

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

my-vpc: EC2.Vpc.new {
  cidrBlock: "10.0.0.0/16",
  region: AWS.Us-west-2
}

subnet1: EC2.Subnet.new {
  cidrBlock: '10.0.1.0/24',
  vpc: my-vpc,
  availabilityZone: AWS.A,
  mapPublicIpOnLaunch: True
}

Following the same pattern as the VPC and subnet declarations, now an internet gateway is added. There is not much to say about an IGW, so this declaration is very small and easy.

my-igw: EC2.InternetGateway.new {
  vpc: my-vpc
}

Running and Compiling the Composition

You can run this composition with the following command:

fugue run Tutorial3.lw

This will create a VPC, subnet, and internet gateway in your AWS account.

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

fugue update [ALIAS or FID] Tutorial3.lw

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

lwc Tutorial3.lw