Skip to the content.

networking Submodule

Constructs

ElasticIp

An EC2 Elastic IP address.

Initializers

import { networking } from 'shady-island'

new networking.ElasticIp(scope: Construct, id: string, props?: ElasticIpProps)
Name Type Description
scope constructs.Construct - The scope in which to define this construct.
id string - The scoped construct ID.
props ElasticIpProps - Initialization properties for this construct.

scopeRequired

The scope in which to define this construct.


idRequired

The scoped construct ID.


propsOptional

Initialization properties for this construct.


Methods

Name Description
toString Returns a string representation of this construct.
applyRemovalPolicy Apply the given removal policy to this resource.
grant Grant the given identity custom permissions.

toString
public toString(): string

Returns a string representation of this construct.

applyRemovalPolicy
public applyRemovalPolicy(policy: RemovalPolicy): void

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

policyRequired

grant
public grant(identity: IGrantable, actions: ...string[]): Grant

Grant the given identity custom permissions.

e.g. ec2:AssociateAddress, ec2:DisableAddressTransfer, ec2:DisassociateAddress, ec2:EnableAddressTransfer, among others.

identityRequired

actionsRequired

Static Functions

Name Description
isConstruct Checks if x is a construct.
isOwnedResource Returns true if the construct was created by CDK, and false otherwise.
isResource Check whether the given construct is a Resource.
fromAllocationId Import an existing EIP from the given allocation ID.
fromElasticIpArn Import an existing EIP from its ARN.

isConstruct
import { networking } from 'shady-island'

networking.ElasticIp.isConstruct(x: any)

Checks if x is a construct.

xRequired

Any object.


isOwnedResource
import { networking } from 'shady-island'

networking.ElasticIp.isOwnedResource(construct: IConstruct)

Returns true if the construct was created by CDK, and false otherwise.

constructRequired

isResource
import { networking } from 'shady-island'

networking.ElasticIp.isResource(construct: IConstruct)

Check whether the given construct is a Resource.

constructRequired

fromAllocationId
import { networking } from 'shady-island'

networking.ElasticIp.fromAllocationId(scope: Construct, id: string, allocationId: string)

Import an existing EIP from the given allocation ID.

scopeRequired

The scope in which to define this construct.


idRequired

The scoped construct ID.


allocationIdRequired

The EIP allocation ID.


fromElasticIpArn
import { networking } from 'shady-island'

networking.ElasticIp.fromElasticIpArn(scope: Construct, id: string, arn: string)

Import an existing EIP from its ARN.

scopeRequired

The scope in which to define this construct.


idRequired

The scoped construct ID.


arnRequired

The EIP ARN.


Properties

Name Type Description
node constructs.Node The tree node.
env aws-cdk-lib.ResourceEnvironment The environment this resource belongs to.
stack aws-cdk-lib.Stack The stack in which this resource is defined.
allocationId string The allocation ID of the Elastic IP address.
elasticIpArn string The ARN of the Elastic IP address.
publicIp string The IPv4 address.

nodeRequired
public readonly node: Node;

The tree node.


envRequired
public readonly env: ResourceEnvironment;

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


stackRequired
public readonly stack: Stack;

The stack in which this resource is defined.


allocationIdRequired
public readonly allocationId: string;

The allocation ID of the Elastic IP address.


elasticIpArnRequired
public readonly elasticIpArn: string;

The ARN of the Elastic IP address.


publicIpRequired
public readonly publicIp: string;

The IPv4 address.


NetworkInterface

A Network Interface.

Initializers

import { networking } from 'shady-island'

new networking.NetworkInterface(scope: Construct, id: string, props: NetworkInterfaceProps)
Name Type Description
scope constructs.Construct - The scope in which to define this construct.
id string - The scoped construct ID.
props NetworkInterfaceProps - Initialization properties for this construct.

scopeRequired

The scope in which to define this construct.


idRequired

The scoped construct ID.


propsRequired

Initialization properties for this construct.


Methods

Name Description
toString Returns a string representation of this construct.
applyRemovalPolicy Apply the given removal policy to this resource.

toString
public toString(): string

Returns a string representation of this construct.

applyRemovalPolicy
public applyRemovalPolicy(policy: RemovalPolicy): void

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

policyRequired

Static Functions

Name Description
isConstruct Checks if x is a construct.
isOwnedResource Returns true if the construct was created by CDK, and false otherwise.
isResource Check whether the given construct is a Resource.
fromNetworkInterfaceAttributes Import an existing Network Interface from the given attributes.

isConstruct
import { networking } from 'shady-island'

networking.NetworkInterface.isConstruct(x: any)

Checks if x is a construct.

xRequired

Any object.


isOwnedResource
import { networking } from 'shady-island'

networking.NetworkInterface.isOwnedResource(construct: IConstruct)

Returns true if the construct was created by CDK, and false otherwise.

constructRequired

isResource
import { networking } from 'shady-island'

networking.NetworkInterface.isResource(construct: IConstruct)

Check whether the given construct is a Resource.

constructRequired

fromNetworkInterfaceAttributes
import { networking } from 'shady-island'

networking.NetworkInterface.fromNetworkInterfaceAttributes(scope: Construct, id: string, attribs: NetworkInterfaceAttributes)

Import an existing Network Interface from the given attributes.

scopeRequired

The scope in which to define this construct.


idRequired

The scoped construct ID.


attribsRequired

The Network Interface attributes.


Properties

Name Type Description
node constructs.Node The tree node.
env aws-cdk-lib.ResourceEnvironment The environment this resource belongs to.
stack aws-cdk-lib.Stack The stack in which this resource is defined.
connections aws-cdk-lib.aws_ec2.Connections The network connections associated with this resource.
ipv6Address string No description.
networkInterfaceId string The ID of this Network Interface.
privateIpv4Address string No description.
subnet aws-cdk-lib.aws_ec2.ISubnet The subnet of this Network Interface.

nodeRequired
public readonly node: Node;

The tree node.


envRequired
public readonly env: ResourceEnvironment;

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


stackRequired
public readonly stack: Stack;

The stack in which this resource is defined.


connectionsRequired
public readonly connections: Connections;

The network connections associated with this resource.


ipv6AddressRequired
public readonly ipv6Address: string;

networkInterfaceIdRequired
public readonly networkInterfaceId: string;

The ID of this Network Interface.


privateIpv4AddressRequired
public readonly privateIpv4Address: string;

subnetRequired
public readonly subnet: ISubnet;

The subnet of this Network Interface.


SecretHttpHeader

Configure a secret header an ALB can require for every request.

Initializers

import { networking } from 'shady-island'

new networking.SecretHttpHeader(scope: Construct, id: string, props?: SecretHttpHeaderProps)
Name Type Description
scope constructs.Construct - The parent scope.
id string - The construct identifier.
props SecretHttpHeaderProps - The configuration properties.

scopeRequired

The parent scope.


idRequired

The construct identifier.


propsOptional

The configuration properties.


Methods

Name Description
toString Returns a string representation of this construct.
createListenerCondition No description.
createOriginCustomHeaders No description.

toString
public toString(): string

Returns a string representation of this construct.

createListenerCondition
public createListenerCondition(): ListenerCondition
createOriginCustomHeaders
public createOriginCustomHeaders(): {[ key: string ]: string}

Static Functions

Name Description
isConstruct Checks if x is a construct.
fromSecret Create a SecretHttpHeader from an existing Secrets Manager secret.

isConstruct
import { networking } from 'shady-island'

networking.SecretHttpHeader.isConstruct(x: any)

Checks if x is a construct.

xRequired

Any object.


fromSecret
import { networking } from 'shady-island'

networking.SecretHttpHeader.fromSecret(scope: Construct, id: string, secret: ISecret)

Create a SecretHttpHeader from an existing Secrets Manager secret.

The secret must be in JSON format and have two fields: name and value.

scopeRequired

The parent scope.


idRequired

The ID for the new construct.


secretRequired

The existing Secrets Manager secret.


Properties

Name Type Description
node constructs.Node The tree node.
defaultHeaderName string Gets the default header name.
headerName string No description.
headerValue aws-cdk-lib.SecretValue No description.
secret aws-cdk-lib.aws_secretsmanager.ISecret The Secrets Manager secret that contains the name and value of the header.

nodeRequired
public readonly node: Node;

The tree node.


defaultHeaderNameRequired
public readonly defaultHeaderName: string;

Gets the default header name.


headerNameRequired
public readonly headerName: string;

headerValueRequired
public readonly headerValue: SecretValue;

secretRequired
public readonly secret: ISecret;

The Secrets Manager secret that contains the name and value of the header.


SingletonLaunchTemplate

A launch template bound to a single Elastic Network Interface.

Initializers

import { networking } from 'shady-island'

new networking.SingletonLaunchTemplate(scope: Construct, id: string, props: SingletonLaunchTemplateProps)
Name Type Description
scope constructs.Construct - The scope in which to define this construct.
id string - The scoped construct ID.
props SingletonLaunchTemplateProps - Initialization properties for this construct.

scopeRequired

The scope in which to define this construct.


idRequired

The scoped construct ID.


propsRequired

Initialization properties for this construct.


Methods

Name Description
toString Returns a string representation of this construct.
applyRemovalPolicy Apply the given removal policy to this resource.
addSecurityGroup Add the security group to the instance.
createAutoScalingGroup Creates an auto-scaling group for this launch template.

toString
public toString(): string

Returns a string representation of this construct.

applyRemovalPolicy
public applyRemovalPolicy(policy: RemovalPolicy): void

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

policyRequired

addSecurityGroup
public addSecurityGroup(securityGroup: ISecurityGroup): void

Add the security group to the instance.

securityGroupRequired

createAutoScalingGroup
public createAutoScalingGroup(id: string, props: AutoScalingGroupProps): AutoScalingGroup

Creates an auto-scaling group for this launch template.

The following properties are ignored (if specified): launchTemplate, minCapacity, and maxCapacity.

idRequired

The ID of the auto-scaling group.


propsRequired

Constructor properties of the AutoScalingGroup.


Static Functions

Name Description
isConstruct Checks if x is a construct.
isOwnedResource Returns true if the construct was created by CDK, and false otherwise.
isResource Check whether the given construct is a Resource.
fromLaunchTemplateAttributes Import an existing LaunchTemplate.

isConstruct
import { networking } from 'shady-island'

networking.SingletonLaunchTemplate.isConstruct(x: any)

Checks if x is a construct.

xRequired

Any object.


isOwnedResource
import { networking } from 'shady-island'

networking.SingletonLaunchTemplate.isOwnedResource(construct: IConstruct)

Returns true if the construct was created by CDK, and false otherwise.

constructRequired

isResource
import { networking } from 'shady-island'

networking.SingletonLaunchTemplate.isResource(construct: IConstruct)

Check whether the given construct is a Resource.

constructRequired

fromLaunchTemplateAttributes
import { networking } from 'shady-island'

networking.SingletonLaunchTemplate.fromLaunchTemplateAttributes(scope: Construct, id: string, attrs: LaunchTemplateAttributes)

Import an existing LaunchTemplate.

scopeRequired

idRequired

attrsRequired

Properties

Name Type Description
node constructs.Node The tree node.
env aws-cdk-lib.ResourceEnvironment The environment this resource belongs to.
stack aws-cdk-lib.Stack The stack in which this resource is defined.
connections aws-cdk-lib.aws_ec2.Connections Allows specifying security group connections for the instance.
defaultVersionNumber string The default version for the launch template.
grantPrincipal aws-cdk-lib.aws_iam.IPrincipal Principal to grant permissions to.
latestVersionNumber string The latest version of the launch template.
versionNumber string The version number of this launch template to use.
imageId string The AMI ID of the image to use.
instanceType aws-cdk-lib.aws_ec2.InstanceType Type of instance to launch.
launchTemplateId string The identifier of the Launch Template.
launchTemplateName string The name of the Launch Template.
osType aws-cdk-lib.aws_ec2.OperatingSystemType The type of OS the instance is running.
role aws-cdk-lib.aws_iam.IRole IAM Role assumed by instances that are launched from this template.
userData aws-cdk-lib.aws_ec2.UserData UserData executed by instances that are launched from this template.
networkInterface INetworkInterface The network interface used by this launch template.

nodeRequired
public readonly node: Node;

The tree node.


envRequired
public readonly env: ResourceEnvironment;

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


stackRequired
public readonly stack: Stack;

The stack in which this resource is defined.


connectionsRequired
public readonly connections: Connections;

Allows specifying security group connections for the instance.


defaultVersionNumberRequired
public readonly defaultVersionNumber: string;

The default version for the launch template.


grantPrincipalRequired
public readonly grantPrincipal: IPrincipal;

Principal to grant permissions to.


latestVersionNumberRequired
public readonly latestVersionNumber: string;

The latest version of the launch template.


versionNumberRequired
public readonly versionNumber: string;

The version number of this launch template to use.


imageIdOptional
public readonly imageId: string;

The AMI ID of the image to use.


instanceTypeOptional
public readonly instanceType: InstanceType;

Type of instance to launch.


launchTemplateIdOptional
public readonly launchTemplateId: string;

The identifier of the Launch Template.

Exactly one of launchTemplateId and launchTemplateName will be set.


launchTemplateNameOptional
public readonly launchTemplateName: string;

The name of the Launch Template.

Exactly one of launchTemplateId and launchTemplateName will be set.


osTypeOptional
public readonly osType: OperatingSystemType;

The type of OS the instance is running.


roleOptional
public readonly role: IRole;

IAM Role assumed by instances that are launched from this template.


userDataOptional
public readonly userData: UserData;

UserData executed by instances that are launched from this template.


networkInterfaceRequired
public readonly networkInterface: INetworkInterface;

The network interface used by this launch template.


WebLoadBalancing

A utility for creating a public-facing Application Load Balancer.

Initializers

import { networking } from 'shady-island'

new networking.WebLoadBalancing(scope: Construct, id: string, props: WebLoadBalancingProps)
Name Type Description
scope constructs.Construct - The scope in which to define this construct.
id string - The scoped construct ID.
props WebLoadBalancingProps - Initialization properties for this construct.

scopeRequired

The scope in which to define this construct.


idRequired

The scoped construct ID.


propsRequired

Initialization properties for this construct.


Methods

Name Description
toString Returns a string representation of this construct.
addTarget Adds a target to the listener.

toString
public toString(): string

Returns a string representation of this construct.

addTarget
public addTarget(id: string, target: IApplicationLoadBalancerTarget, options?: TargetOptions): IApplicationTargetGroup

Adds a target to the listener.

If the following options are left undefined, these defaults will be used.

idRequired

The ID of the new target group.


targetRequired

The load balancing target to receive traffic.


optionsOptional

The target group options.


Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { networking } from 'shady-island'

networking.WebLoadBalancing.isConstruct(x: any)

Checks if x is a construct.

xRequired

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
listener aws-cdk-lib.aws_elasticloadbalancingv2.IApplicationListener The HTTPS listener.
loadBalancer aws-cdk-lib.aws_elasticloadbalancingv2.IApplicationLoadBalancer The load balancer itself.
secretHeader ISecretHttpHeader The secret header (if requireSecretHeader was set to true).

nodeRequired
public readonly node: Node;

The tree node.


listenerRequired
public readonly listener: IApplicationListener;

The HTTPS listener.


loadBalancerRequired
public readonly loadBalancer: IApplicationLoadBalancer;

The load balancer itself.


secretHeaderOptional
public readonly secretHeader: ISecretHttpHeader;

The secret header (if requireSecretHeader was set to true).


Structs

ElasticIpProps

Constructor properties for ElasticIp.

Initializer

import { networking } from 'shady-island'

const elasticIpProps: networking.ElasticIpProps = { ... }

Properties

Name Type Description
removalPolicy aws-cdk-lib.RemovalPolicy The removal policy for this resource.

removalPolicyOptional
public readonly removalPolicy: RemovalPolicy;

The removal policy for this resource.


NetworkInterfaceAttributes

Attributes to import an existing Network Interface.

Initializer

import { networking } from 'shady-island'

const networkInterfaceAttributes: networking.NetworkInterfaceAttributes = { ... }

Properties

Name Type Description
networkInterfaceId string The ID of this Network Interface.
securityGroups aws-cdk-lib.aws_ec2.ISecurityGroup[] The security groups assigned to the Network Interface.
subnet aws-cdk-lib.aws_ec2.ISubnet The subnet where this Network Interface will be created.

networkInterfaceIdRequired
public readonly networkInterfaceId: string;

The ID of this Network Interface.


securityGroupsRequired
public readonly securityGroups: ISecurityGroup[];

The security groups assigned to the Network Interface.


subnetRequired
public readonly subnet: ISubnet;

The subnet where this Network Interface will be created.


NetworkInterfaceProps

Constructor properties for NetworkInterface.

Initializer

import { networking } from 'shady-island'

const networkInterfaceProps: networking.NetworkInterfaceProps = { ... }

Properties

Name Type Description
subnet aws-cdk-lib.aws_ec2.ISubnet The subnet where this Network Interface will be created.
vpc aws-cdk-lib.aws_ec2.IVpc The VPC where this Network Interface will be created.
description string A description for this Network Interface.
elasticIp IElasticIp An Elastic IP Address to associate with this Network Interface.
enableSourceDestCheck boolean Enable the source/destination check.
interfaceType InterfaceType The type of interface (i.e. interface, efa, trunk).
ipv4 AddressingV4 How to assign IPv4 addresses.
ipv6 AddressingV6 How to assign IPv6 addresses.
removalPolicy aws-cdk-lib.RemovalPolicy The removal policy for this resource.
securityGroups aws-cdk-lib.aws_ec2.ISecurityGroup[] The security groups to assign to the Network Interface.

subnetRequired
public readonly subnet: ISubnet;

The subnet where this Network Interface will be created.


vpcRequired
public readonly vpc: IVpc;

The VPC where this Network Interface will be created.


descriptionOptional
public readonly description: string;

A description for this Network Interface.


elasticIpOptional
public readonly elasticIp: IElasticIp;

An Elastic IP Address to associate with this Network Interface.

Provding an Elastic IP


enableSourceDestCheckOptional
public readonly enableSourceDestCheck: boolean;

Enable the source/destination check.


interfaceTypeOptional
public readonly interfaceType: InterfaceType;

The type of interface (i.e. interface, efa, trunk).


ipv4Optional
public readonly ipv4: AddressingV4;

How to assign IPv4 addresses.

The default behavior depends on the VPC. If it’s a dual stack VPC, EC2 will allocate a single private IP address from the VPC IPv4 CIDR range. If it’s IPv6-only, EC2 won’t allocate an IPv4 address.


ipv6Optional
public readonly ipv6: AddressingV6;

How to assign IPv6 addresses.

The default behavior depends on the VPC. If there are no IPv6 CIDRs defined for the VPC, EC2 won’t allocate an IPv6 address. If it’s a dual stack or an IPv6-only VPC, EC2 will allocate an IPv6 address if the subnet auto-assigns one.


removalPolicyOptional
public readonly removalPolicy: RemovalPolicy;

The removal policy for this resource.


securityGroupsOptional
public readonly securityGroups: ISecurityGroup[];

The security groups to assign to the Network Interface.


SecretHttpHeaderProps

Properties for the SecretHttpHeader constructor.

Initializer

import { networking } from 'shady-island'

const secretHttpHeaderProps: networking.SecretHttpHeaderProps = { ... }

Properties

Name Type Description
headerName string The name of the secret HTTP header.

headerNameOptional
public readonly headerName: string;

The name of the secret HTTP header.


SingletonLaunchTemplateProps

Constructor properties for SingletonLaunchTemplate.

Initializer

import { networking } from 'shady-island'

const singletonLaunchTemplateProps: networking.SingletonLaunchTemplateProps = { ... }

Properties

Name Type Description
associatePublicIpAddress boolean Whether instances should have a public IP addresses associated with them.
blockDevices aws-cdk-lib.aws_ec2.BlockDevice[] Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.
cpuCredits aws-cdk-lib.aws_ec2.CpuCredits CPU credit type for burstable EC2 instance types.
detailedMonitoring boolean If set to true, then detailed monitoring will be enabled on instances created with this launch template.
disableApiTermination boolean If you set this parameter to true, you cannot terminate the instances launched with this launch template using the Amazon EC2 console, CLI, or API;
ebsOptimized boolean Indicates whether the instances are optimized for Amazon EBS I/O.
hibernationConfigured boolean If you set this parameter to true, the instance is enabled for hibernation.
httpEndpoint boolean Enables or disables the HTTP metadata endpoint on your instances.
httpProtocolIpv6 boolean Enables or disables the IPv6 endpoint for the instance metadata service.
httpPutResponseHopLimit number The desired HTTP PUT response hop limit for instance metadata requests.
httpTokens aws-cdk-lib.aws_ec2.LaunchTemplateHttpTokens The state of token usage for your instance metadata requests.
instanceInitiatedShutdownBehavior aws-cdk-lib.aws_ec2.InstanceInitiatedShutdownBehavior Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
instanceMetadataTags boolean Set to enabled to allow access to instance tags from the instance metadata.
instanceProfile aws-cdk-lib.aws_iam.IInstanceProfile The instance profile used to pass role information to EC2 instances.
instanceType aws-cdk-lib.aws_ec2.InstanceType Type of instance to launch.
keyName string Name of SSH keypair to grant access to instance.
keyPair aws-cdk-lib.aws_ec2.IKeyPair The SSH keypair to grant access to the instance.
launchTemplateName string Name for this launch template.
machineImage aws-cdk-lib.aws_ec2.IMachineImage The AMI that will be used by instances.
nitroEnclaveEnabled boolean If this parameter is set to true, the instance is enabled for AWS Nitro Enclaves;
requireImdsv2 boolean Whether IMDSv2 should be required on launched instances.
role aws-cdk-lib.aws_iam.IRole An IAM role to associate with the instance profile that is used by instances.
securityGroup aws-cdk-lib.aws_ec2.ISecurityGroup Security group to assign to instances created with the launch template.
spotOptions aws-cdk-lib.aws_ec2.LaunchTemplateSpotOptions If this property is defined, then the Launch Template’s InstanceMarketOptions will be set to use Spot instances, and the options for the Spot instances will be as defined.
userData aws-cdk-lib.aws_ec2.UserData The AMI that will be used by instances.
networkInterface INetworkInterface The Elastic Network Interface to use.

associatePublicIpAddressOptional
public readonly associatePublicIpAddress: boolean;

Whether instances should have a public IP addresses associated with them.


blockDevicesOptional
public readonly blockDevices: BlockDevice[];

Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.

Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html


cpuCreditsOptional
public readonly cpuCredits: CpuCredits;

CPU credit type for burstable EC2 instance types.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html


detailedMonitoringOptional
public readonly detailedMonitoring: boolean;

If set to true, then detailed monitoring will be enabled on instances created with this launch template.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch-new.html


disableApiTerminationOptional
public readonly disableApiTermination: boolean;

If you set this parameter to true, you cannot terminate the instances launched with this launch template using the Amazon EC2 console, CLI, or API;

otherwise, you can.


ebsOptimizedOptional
public readonly ebsOptimized: boolean;

Indicates whether the instances are optimized for Amazon EBS I/O.

This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization isn’t available with all instance types. Additional usage charges apply when using an EBS-optimized instance.


hibernationConfiguredOptional
public readonly hibernationConfigured: boolean;

If you set this parameter to true, the instance is enabled for hibernation.


httpEndpointOptional
public readonly httpEndpoint: boolean;

Enables or disables the HTTP metadata endpoint on your instances.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-metadataoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-metadataoptions-httpendpoint


httpProtocolIpv6Optional
public readonly httpProtocolIpv6: boolean;

Enables or disables the IPv6 endpoint for the instance metadata service.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-metadataoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-metadataoptions-httpprotocolipv6


httpPutResponseHopLimitOptional
public readonly httpPutResponseHopLimit: number;

The desired HTTP PUT response hop limit for instance metadata requests.

The larger the number, the further instance metadata requests can travel.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-metadataoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-metadataoptions-httpputresponsehoplimit


httpTokensOptional
public readonly httpTokens: LaunchTemplateHttpTokens;

The state of token usage for your instance metadata requests.

The default state is optional if not specified. However, if requireImdsv2 is true, the state must be required.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-metadataoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-metadataoptions-httptokens


instanceInitiatedShutdownBehaviorOptional
public readonly instanceInitiatedShutdownBehavior: InstanceInitiatedShutdownBehavior;

Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingInstanceInitiatedShutdownBehavior


instanceMetadataTagsOptional
public readonly instanceMetadataTags: boolean;

Set to enabled to allow access to instance tags from the instance metadata.

Set to disabled to turn off access to instance tags from the instance metadata.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata-metadataoptions.html#cfn-ec2-launchtemplate-launchtemplatedata-metadataoptions-instancemetadatatags


instanceProfileOptional
public readonly instanceProfile: IInstanceProfile;

The instance profile used to pass role information to EC2 instances.

Note: You can provide an instanceProfile or a role, but not both.


instanceTypeOptional
public readonly instanceType: InstanceType;

Type of instance to launch.


keyNameOptional
public readonly keyName: string;

Name of SSH keypair to grant access to instance.


keyPairOptional
public readonly keyPair: IKeyPair;

The SSH keypair to grant access to the instance.


launchTemplateNameOptional
public readonly launchTemplateName: string;

Name for this launch template.


machineImageOptional
public readonly machineImage: IMachineImage;

The AMI that will be used by instances.


nitroEnclaveEnabledOptional
public readonly nitroEnclaveEnabled: boolean;

If this parameter is set to true, the instance is enabled for AWS Nitro Enclaves;

otherwise, it is not enabled for AWS Nitro Enclaves.


requireImdsv2Optional
public readonly requireImdsv2: boolean;

Whether IMDSv2 should be required on launched instances.


roleOptional
public readonly role: IRole;

An IAM role to associate with the instance profile that is used by instances.

The role must be assumable by the service principal ec2.amazonaws.com. Note: You can provide an instanceProfile or a role, but not both.


Example

const role = new iam.Role(this, 'MyRole', {
  assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com')
});
securityGroupOptional
public readonly securityGroup: ISecurityGroup;

Security group to assign to instances created with the launch template.


spotOptionsOptional
public readonly spotOptions: LaunchTemplateSpotOptions;

If this property is defined, then the Launch Template’s InstanceMarketOptions will be set to use Spot instances, and the options for the Spot instances will be as defined.


userDataOptional
public readonly userData: UserData;

The AMI that will be used by instances.


networkInterfaceRequired
public readonly networkInterface: INetworkInterface;

The Elastic Network Interface to use.


TargetOptions

Options for adding a new target group.

Initializer

import { networking } from 'shady-island'

const targetOptions: networking.TargetOptions = { ... }

Properties

Name Type Description
deregistrationDelay aws-cdk-lib.Duration The amount of time for Elastic Load Balancing to wait before deregistering a target.
healthCheck aws-cdk-lib.aws_elasticloadbalancingv2.HealthCheck Health check configuration.
targetGroupName string The name of the target group.
targetType aws-cdk-lib.aws_elasticloadbalancingv2.TargetType The type of targets registered to this TargetGroup, either IP or Instance.
vpc aws-cdk-lib.aws_ec2.IVpc The virtual private cloud (VPC).
loadBalancingAlgorithmType aws-cdk-lib.aws_elasticloadbalancingv2.TargetGroupLoadBalancingAlgorithmType The load balancing algorithm to select targets for routing requests.
port number The port on which the target receives traffic.
protocol aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationProtocol The protocol used for communication with the target.
protocolVersion aws-cdk-lib.aws_elasticloadbalancingv2.ApplicationProtocolVersion The protocol version to use.
slowStart aws-cdk-lib.Duration The time period during which the load balancer sends a newly registered target a linearly increasing share of the traffic to the target group.
stickinessCookieDuration aws-cdk-lib.Duration The stickiness cookie expiration period.
stickinessCookieName string The name of an application-based stickiness cookie.
targets aws-cdk-lib.aws_elasticloadbalancingv2.IApplicationLoadBalancerTarget[] The targets to add to this target group.
hostnames string[] The hostnames on which traffic is served.
priority number The priority of the listener rule.

deregistrationDelayOptional
public readonly deregistrationDelay: Duration;

The amount of time for Elastic Load Balancing to wait before deregistering a target.

The range is 0-3600 seconds.


healthCheckOptional
public readonly healthCheck: HealthCheck;

Health check configuration.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-elasticloadbalancingv2-targetgroup.html#aws-resource-elasticloadbalancingv2-targetgroup-properties


targetGroupNameOptional
public readonly targetGroupName: string;

The name of the target group.

This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.


targetTypeOptional
public readonly targetType: TargetType;

The type of targets registered to this TargetGroup, either IP or Instance.

All targets registered into the group must be of this type. If you register targets to the TargetGroup in the CDK app, the TargetType is determined automatically.


vpcOptional
public readonly vpc: IVpc;

The virtual private cloud (VPC).

only if TargetType is Ip or InstanceId


loadBalancingAlgorithmTypeOptional
public readonly loadBalancingAlgorithmType: TargetGroupLoadBalancingAlgorithmType;

The load balancing algorithm to select targets for routing requests.


portOptional
public readonly port: number;

The port on which the target receives traffic.

This is not applicable for Lambda targets.


protocolOptional
public readonly protocol: ApplicationProtocol;

The protocol used for communication with the target.

This is not applicable for Lambda targets.


protocolVersionOptional
public readonly protocolVersion: ApplicationProtocolVersion;

The protocol version to use.


slowStartOptional
public readonly slowStart: Duration;

The time period during which the load balancer sends a newly registered target a linearly increasing share of the traffic to the target group.

The range is 30-900 seconds (15 minutes).


stickinessCookieDurationOptional
public readonly stickinessCookieDuration: Duration;

The stickiness cookie expiration period.

Setting this value enables load balancer stickiness.

After this period, the cookie is considered stale. The minimum value is 1 second and the maximum value is 7 days (604800 seconds).


stickinessCookieNameOptional
public readonly stickinessCookieName: string;

The name of an application-based stickiness cookie.

Names that start with the following prefixes are not allowed: AWSALB, AWSALBAPP, and AWSALBTG; they’re reserved for use by the load balancer.

Note: stickinessCookieName parameter depends on the presence of stickinessCookieDuration parameter. If stickinessCookieDuration is not set, stickinessCookieName will be omitted.

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html


targetsOptional
public readonly targets: IApplicationLoadBalancerTarget[];

The targets to add to this target group.

Can be Instance, IPAddress, or any self-registering load balancing target. If you use either Instance or IPAddress as targets, all target must be of the same type.


hostnamesOptional
public readonly hostnames: string[];

The hostnames on which traffic is served.


priorityOptional
public readonly priority: number;

The priority of the listener rule.


WebLoadBalancingProps

Constructor properties for WebLoadBalancing.

Initializer

import { networking } from 'shady-island'

const webLoadBalancingProps: networking.WebLoadBalancingProps = { ... }

Properties

Name Type Description
certificates aws-cdk-lib.aws_certificatemanager.ICertificate[] The certificate to attach to the load balancer and CloudFront distribution.
vpc aws-cdk-lib.aws_ec2.IVpc The VPC where these resources should be deployed.
idleTimeout aws-cdk-lib.Duration The load balancer idle timeout, in seconds.
ipAddressType aws-cdk-lib.aws_elasticloadbalancingv2.IpAddressType The type of IP addresses to use (IPv4 or Dual Stack).
requireKnownHostname boolean Forbid requests that ask for an unknown hostname.
requireSecretHeader boolean Forbid requests that are missing an HTTP header with a specific value.
secretHeaderName string The name of the secret HTTP header.
securityGroup aws-cdk-lib.aws_ec2.ISecurityGroup A security group for the load balancer itself.

certificatesRequired
public readonly certificates: ICertificate[];

The certificate to attach to the load balancer and CloudFront distribution.


vpcRequired
public readonly vpc: IVpc;

The VPC where these resources should be deployed.


idleTimeoutOptional
public readonly idleTimeout: Duration;

The load balancer idle timeout, in seconds.

If you have a reverse proxy in front of this load balancer, such as CloudFront, this number should be less than the reverse proxy’s request timeout.


ipAddressTypeOptional
public readonly ipAddressType: IpAddressType;

The type of IP addresses to use (IPv4 or Dual Stack).


requireKnownHostnameOptional
public readonly requireKnownHostname: boolean;

Forbid requests that ask for an unknown hostname.

Requests for an unknown hostname will receive an HTTP 421 status response.


requireSecretHeaderOptional
public readonly requireSecretHeader: boolean;

Forbid requests that are missing an HTTP header with a specific value.

If this option is set to true, this construct will provide a new SecretHttpHeader accessible on the secretHeader property.

Requests without the correct header name and value will receive an HTTP 421 status response.


secretHeaderNameOptional
public readonly secretHeaderName: string;

The name of the secret HTTP header.

Providing this option implies that requireSecretHeader is true.


securityGroupOptional
public readonly securityGroup: ISecurityGroup;

A security group for the load balancer itself.


Classes

Address

An IPv4 or IPv6 address (or range of addresses).

Methods

Name Description
isAny Whether this address represents everything in the addressing space.
isIpv4 Whether this address is an IPv4 address.
isIpv6 Whether this address is an IPv6 address.
toString No description.

isAny
public isAny(): boolean

Whether this address represents everything in the addressing space.

isIpv4
public isIpv4(): boolean

Whether this address is an IPv4 address.

isIpv6
public isIpv6(): boolean

Whether this address is an IPv6 address.

toString
public toString(): string

Static Functions

Name Description
anyIpv4 Creates an address that represents the entire IPv4 addressing space.
anyIpv6 Creates an address that represents the entire IPv4 addressing space.
ipv4 Creates an IPv4 network address (either a single address or a range).
ipv6 Creates an IPv6 network address (either a single address or a range).

anyIpv4
import { networking } from 'shady-island'

networking.Address.anyIpv4()

Creates an address that represents the entire IPv4 addressing space.

anyIpv6
import { networking } from 'shady-island'

networking.Address.anyIpv6()

Creates an address that represents the entire IPv4 addressing space.

ipv4
import { networking } from 'shady-island'

networking.Address.ipv4(address: string)

Creates an IPv4 network address (either a single address or a range).

addressRequired

The IP address (with optional netmask).


ipv6
import { networking } from 'shady-island'

networking.Address.ipv6(address: string)

Creates an IPv6 network address (either a single address or a range).

addressRequired

The IP address (with optional prefix length).


AddressingV4

Used to assign IPv4 addresses to a Network Interface.

Static Functions

Name Description
prefixCount Specify a number of IPv4 delegated prefixes to automatically assign.
prefixes Specify one or more IPv4 delegated prefixes to assign.
privateAddress Specify a private IPv4 address.
privateAddressAndSecondaryCount Specify a primary IPv4 address and a number of secondary addresses.
privateAddresses Specify a primary IPv4 address and one or more secondary IPv4 addresses.

prefixCount
import { networking } from 'shady-island'

networking.AddressingV4.prefixCount(count: number)

Specify a number of IPv4 delegated prefixes to automatically assign.

countRequired

The number of automatic IPv4 delegated prefixes.


prefixes
import { networking } from 'shady-island'

networking.AddressingV4.prefixes(prefixes: string[])

Specify one or more IPv4 delegated prefixes to assign.

IPv4 prefixes must be within a CIDR of /28.

prefixesRequired

The IPv4 delegated prefixes.


privateAddress
import { networking } from 'shady-island'

networking.AddressingV4.privateAddress(ip: string)

Specify a private IPv4 address.

ipRequired

The actual IP address.


privateAddressAndSecondaryCount
import { networking } from 'shady-island'

networking.AddressingV4.privateAddressAndSecondaryCount(primary: string, count: number)

Specify a primary IPv4 address and a number of secondary addresses.

primaryRequired

The primary address.


countRequired

The number of secondary addresses.


privateAddresses
import { networking } from 'shady-island'

networking.AddressingV4.privateAddresses(primary: string, secondary: ...string[])

Specify a primary IPv4 address and one or more secondary IPv4 addresses.

primaryRequired

The primary address.


secondaryRequired

Any secondary addresses.


Properties

Name Type Description
props {[ key: string ]: any} No description.

propsRequired
public readonly props: {[ key: string ]: any};

AddressingV6

Used to assign IPv6 addresses to a Network Interface.

Static Functions

Name Description
addressCount Specify a number of IPv6 addresses to automatically assign.
addresses Specify one or more IPv6 addresses to assign.
prefixCount Specify a number of IPv6 delegated prefixes to automatically assign.
prefixes Specify one or more IPv6 delegated prefixes to assign.

addressCount
import { networking } from 'shady-island'

networking.AddressingV6.addressCount(count: number, enablePrimary?: boolean)

Specify a number of IPv6 addresses to automatically assign.

countRequired

The number of automatic IPv6 addresses.


enablePrimaryOptional

Whether to enable a primary IPv6 GUA (default: no).


addresses
import { networking } from 'shady-island'

networking.AddressingV6.addresses(ips: string[], enablePrimary?: boolean)

Specify one or more IPv6 addresses to assign.

ipsRequired

The IPv6 addresses.


enablePrimaryOptional

Whether to enable a primary IPv6 GUA (default: no).


prefixCount
import { networking } from 'shady-island'

networking.AddressingV6.prefixCount(count: number, enablePrimary?: boolean)

Specify a number of IPv6 delegated prefixes to automatically assign.

countRequired

The number of automatic IPv6 delegated prefixes.


enablePrimaryOptional

Whether to enable a primary IPv6 GUA (default: no).


prefixes
import { networking } from 'shady-island'

networking.AddressingV6.prefixes(prefixes: string[], enablePrimary?: boolean)

Specify one or more IPv6 delegated prefixes to assign.

IPv6 prefixes must be within a CIDR of /80.

prefixesRequired

The IPv6 delegated prefixes.


enablePrimaryOptional

Whether to enable a primary IPv6 GUA (default: no).


Properties

Name Type Description
props {[ key: string ]: any} No description.

propsRequired
public readonly props: {[ key: string ]: any};

Protocols

IElasticIp

An EC2 Elastic IP address.

Methods

Name Description
grant Grant the given identity custom permissions.

grant
public grant(identity: IGrantable, actions: ...string[]): Grant

Grant the given identity custom permissions.

e.g. ec2:AssociateAddress, ec2:DisableAddressTransfer, ec2:DisassociateAddress, ec2:EnableAddressTransfer, among others.

identityRequired

The resource with a grantPrincipal property.


actionsRequired

The IAM actions to allow.


Properties

Name Type Description
node constructs.Node The tree node.
env aws-cdk-lib.ResourceEnvironment The environment this resource belongs to.
stack aws-cdk-lib.Stack The stack in which this resource is defined.
allocationId string The allocation ID of the Elastic IP address.
elasticIpArn string The ARN of the Elastic IP address.

nodeRequired
public readonly node: Node;

The tree node.


envRequired
public readonly env: ResourceEnvironment;

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


stackRequired
public readonly stack: Stack;

The stack in which this resource is defined.


allocationIdRequired
public readonly allocationId: string;

The allocation ID of the Elastic IP address.


elasticIpArnRequired
public readonly elasticIpArn: string;

The ARN of the Elastic IP address.


INetworkInterface

An Elastic Network Interface.

Properties

Name Type Description
node constructs.Node The tree node.
connections aws-cdk-lib.aws_ec2.Connections The network connections associated with this resource.
networkInterfaceId string The ID of this Network Interface.
subnet aws-cdk-lib.aws_ec2.ISubnet The subnet of this Network Interface.

nodeRequired
public readonly node: Node;

The tree node.


connectionsRequired
public readonly connections: Connections;

The network connections associated with this resource.


networkInterfaceIdRequired
public readonly networkInterfaceId: string;

The ID of this Network Interface.


subnetRequired
public readonly subnet: ISubnet;

The subnet of this Network Interface.


ISecretHttpHeader

Interface for SecretHttpHeader.

Methods

Name Description
createListenerCondition Get a ListenerCondition that represents this secret header.
createOriginCustomHeaders Gets the custom headers for a CloudFront origin configuration.

createListenerCondition
public createListenerCondition(): ListenerCondition

Get a ListenerCondition that represents this secret header.

createOriginCustomHeaders
public createOriginCustomHeaders(): {[ key: string ]: string}

Gets the custom headers for a CloudFront origin configuration.

Properties

Name Type Description
node constructs.Node The tree node.
headerName string The name of the secret header.
headerValue aws-cdk-lib.SecretValue The value of the secret header.

nodeRequired
public readonly node: Node;

The tree node.


headerNameRequired
public readonly headerName: string;

The name of the secret header.


headerValueRequired
public readonly headerValue: SecretValue;

The value of the secret header.


Enums

InterfaceType

The type of Network Interface.

Members

Name Description
INTERFACE A standard ENI.
EFA An Elastic Fabric Adapter ENI.
TRUNK An ENI for use with ECS awsvpc trunking.

INTERFACE

A standard ENI.


EFA

An Elastic Fabric Adapter ENI.


TRUNK

An ENI for use with ECS awsvpc trunking.