Skip to content

Resource: awsLightsailStaticIpAttachment

Provides a static IP address attachment - relationship between a Lightsail static IP & Lightsail instance.

\~> Note: Lightsail is currently only supported in a limited number of AWS Regions, please see "Regions and Availability Zones in Amazon Lightsail" for more details

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsLightsailInstanceTest = new aws.lightsailInstance.LightsailInstance(
  this,
  "test",
  {
    availabilityZone: "us-east-1b",
    blueprintId: "string",
    bundleId: "string",
    keyPairName: "some_key_name",
    name: "example",
  }
);
const awsLightsailStaticIpTest = new aws.lightsailStaticIp.LightsailStaticIp(
  this,
  "test_1",
  {
    name: "example",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsLightsailStaticIpTest.overrideLogicalId("test");
const awsLightsailStaticIpAttachmentTest =
  new aws.lightsailStaticIpAttachment.LightsailStaticIpAttachment(
    this,
    "test_2",
    {
      instanceName: awsLightsailInstanceTest.id,
      staticIpName: awsLightsailStaticIpTest.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsLightsailStaticIpAttachmentTest.overrideLogicalId("test");

Argument Reference

The following arguments are supported:

  • staticIpName - (Required) The name of the allocated static IP
  • instanceName - (Required) The name of the Lightsail instance to attach the IP to

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • ipAddress - The allocated static IP address