This is the preferred interface for making Subnets with Fugue. The new function is the right place to start.

Module Members



Create a reference to an externally managed Subnet.

Example usage:

subnet: EC2.Subnet.external("subnet-1234abcd", AWS.Us-east-1)

Type Signature

 fun (String, Region) -> Subnet
Argument: subnetId

The ID of the target Subnet. Must be of the form “subnet-” followed by 8 characters from a-z and 0-9.

Type: String

Argument: region

The Region containing the target Subnet.

Type: Region


A reference to the specified Subnet.

Type: Subnet



new Subnet (Constructor)

Call this constructor to create a new Fugue.AWS.EC2.Subnet value.

Example usage:

sn: EC2.Subnet.new {
  cidrBlock: '',
  vpc: myVpc
  availabilityZone: AWS.A,
  mapPublicIpOnLaunch: True,
  defaultForAz: False,
  tags: [myTag]

Type Signature

 fun { vpc: Vpc,
       cidrBlock: String,
       availabilityZone: Optional<AvailabilityZone>,
       defaultForAz: Optional<Bool>,
       mapPublicIpOnLaunch: Optional<Bool>,
       tags: Optional<List<Tag>>,
       resourceId: Optional<String> } -> Subnet
Argument: vpc

The VPC in which to build the subnet. This must be a valid VPC record, constructed with the EC2.Vpc.new() constructor.

Type: Vpc

Argument: cidrBlock

The network address space the subnet should encompass. This value is validated at compile time by the constructor, and must be a string written in CIDR notation. For more information see: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation

Type: String

Argument: availabilityZone

The availability zone in which the subnet resides. Instances launched in this subnet must also be launched in this availability zone. Of course, this must be a valid availability zone for the region in which the parent VPC is placed.

Type: Optional<AvailabilityZone>

Argument: defaultForAz

The setting for whether this subnet is the default for instances launched in its Availability Zone.

Type: Optional<Bool>

Argument: mapPublicIpOnLaunch

The setting for whether instances launched in this subnet are mapped to public IP addresses on launch. Mutable.

Type: Optional<Bool>

Argument: tags

AWS tag key-value pairs to associate with the subnet. Mutable.

Type: Optional<List<Tag>>

Argument: resourceId

Resource ID of the resource to import with Fugue Import. This field is only honored on fugue run. The resource ID is the AWS ID. Mutable. Example: subnet-1234abcd

Type: Optional<String>


A Fugue.Core.AWS.EC2.Subnet value.

Type: Subnet



Retrieve the region from a Subnet value.

Works for Subnets defined in the composition as well external values.

Example usage:

subnet1: EC2.Subnet.new {
  vpc:  ECS.Vpc.new {
    region: AWS.Us-west-2,
    cidrBlock: "",
  cidrBlock: "",
region1: EC2.Subnet.region(subnet1) # => AWS.Us-west-2

subnet2: EC2.Subnet.external("sn-1234567", AWS.Us-east-1)
region2: EC2.Subnet.region(subnet2) # => AWS.Us-east-1

Type Signature

 fun (Subnet) -> Region
Argument: subnet

The subnet from which to get the region.

Type: Subnet


The region containing the subnet.

Type: Region



type SubnetSpec:
  vpc: Vpc
  cidrBlock: String
  availabilityZone: Optional<AvailabilityZone>
  defaultForAz: Optional<Bool>
  mapPublicIpOnLaunch: Optional<Bool>
  tags: Optional<List<Tag>>


See Fugue.AWS.EC2.Subnet.new for documentation on the current arguments.

Record {

Field: vpc
Type: Vpc
Field: cidrBlock
Type: String
Field: availabilityZone
Type: Optional<AvailabilityZone>
Field: defaultForAz
Type: Optional<Bool>
Field: mapPublicIpOnLaunch
Type: Optional<Bool>
Field: tags
Type: Optional<List<Tag>>




  defaultForAz: None
  mapPublicIpOnLaunch: None
  tags: None

DEPRECATED: Use of Fugue.AWS.EC2.Subnet.default is no longer required. It will be removed in a future release.