UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

202 lines • 7.66 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Eip = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an Elastic IP resource. * * > **Note:** EIP may require IGW to exist prior to association. Use `dependsOn` to set an explicit dependency on the IGW. * * > **Note:** Do not use `networkInterface` to associate the EIP to `aws.lb.LoadBalancer` or `aws.ec2.NatGateway` resources. Instead use the `allocationId` available in those resources to allow AWS to manage the association, otherwise you will see `AuthFailure` errors. * * ## Example Usage * * ### Single EIP associated with an instance * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const lb = new aws.ec2.Eip("lb", { * instance: web.id, * domain: "vpc", * }); * ``` * * ### Multiple EIPs associated with a single network interface * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const multi_ip = new aws.ec2.NetworkInterface("multi-ip", { * subnetId: main.id, * privateIps: [ * "10.0.0.10", * "10.0.0.11", * ], * }); * const one = new aws.ec2.Eip("one", { * domain: "vpc", * networkInterface: multi_ip.id, * associateWithPrivateIp: "10.0.0.10", * }); * const two = new aws.ec2.Eip("two", { * domain: "vpc", * networkInterface: multi_ip.id, * associateWithPrivateIp: "10.0.0.11", * }); * ``` * * ### Attaching an EIP to an Instance with a pre-assigned private ip (VPC Only) * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const _default = new aws.ec2.Vpc("default", { * cidrBlock: "10.0.0.0/16", * enableDnsHostnames: true, * }); * const gw = new aws.ec2.InternetGateway("gw", {vpcId: _default.id}); * const myTestSubnet = new aws.ec2.Subnet("my_test_subnet", { * vpcId: _default.id, * cidrBlock: "10.0.0.0/24", * mapPublicIpOnLaunch: true, * }, { * dependsOn: [gw], * }); * const foo = new aws.ec2.Instance("foo", { * ami: "ami-5189a661", * instanceType: aws.ec2.InstanceType.T2_Micro, * privateIp: "10.0.0.12", * subnetId: myTestSubnet.id, * }); * const bar = new aws.ec2.Eip("bar", { * domain: "vpc", * instance: foo.id, * associateWithPrivateIp: "10.0.0.12", * }, { * dependsOn: [gw], * }); * ``` * * ### Allocating EIP from the BYOIP pool * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const byoip_ip = new aws.ec2.Eip("byoip-ip", { * domain: "vpc", * publicIpv4Pool: "ipv4pool-ec2-012345", * }); * ``` * * ### Allocating EIP from the IPAM Pool * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const ipam_ip = new aws.ec2.Eip("ipam-ip", { * domain: "vpc", * ipamPoolId: "ipam-pool-07ccc86aa41bef7ce", * }); * ``` * * ## Import * * Using `pulumi import`, import EIPs in a VPC using their Allocation ID. For example: * * ```sh * $ pulumi import aws:ec2/eip:Eip bar eipalloc-00a10e96 * ``` */ class Eip extends pulumi.CustomResource { /** * Get an existing Eip resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new Eip(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Eip. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Eip.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["address"] = state?.address; resourceInputs["allocationId"] = state?.allocationId; resourceInputs["arn"] = state?.arn; resourceInputs["associateWithPrivateIp"] = state?.associateWithPrivateIp; resourceInputs["associationId"] = state?.associationId; resourceInputs["carrierIp"] = state?.carrierIp; resourceInputs["customerOwnedIp"] = state?.customerOwnedIp; resourceInputs["customerOwnedIpv4Pool"] = state?.customerOwnedIpv4Pool; resourceInputs["domain"] = state?.domain; resourceInputs["instance"] = state?.instance; resourceInputs["ipamPoolId"] = state?.ipamPoolId; resourceInputs["networkBorderGroup"] = state?.networkBorderGroup; resourceInputs["networkInterface"] = state?.networkInterface; resourceInputs["privateDns"] = state?.privateDns; resourceInputs["privateIp"] = state?.privateIp; resourceInputs["ptrRecord"] = state?.ptrRecord; resourceInputs["publicDns"] = state?.publicDns; resourceInputs["publicIp"] = state?.publicIp; resourceInputs["publicIpv4Pool"] = state?.publicIpv4Pool; resourceInputs["region"] = state?.region; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; } else { const args = argsOrState; resourceInputs["address"] = args?.address; resourceInputs["associateWithPrivateIp"] = args?.associateWithPrivateIp; resourceInputs["customerOwnedIpv4Pool"] = args?.customerOwnedIpv4Pool; resourceInputs["domain"] = args?.domain; resourceInputs["instance"] = args?.instance; resourceInputs["ipamPoolId"] = args?.ipamPoolId; resourceInputs["networkBorderGroup"] = args?.networkBorderGroup; resourceInputs["networkInterface"] = args?.networkInterface; resourceInputs["publicIpv4Pool"] = args?.publicIpv4Pool; resourceInputs["region"] = args?.region; resourceInputs["tags"] = args?.tags; resourceInputs["allocationId"] = undefined /*out*/; resourceInputs["arn"] = undefined /*out*/; resourceInputs["associationId"] = undefined /*out*/; resourceInputs["carrierIp"] = undefined /*out*/; resourceInputs["customerOwnedIp"] = undefined /*out*/; resourceInputs["privateDns"] = undefined /*out*/; resourceInputs["privateIp"] = undefined /*out*/; resourceInputs["ptrRecord"] = undefined /*out*/; resourceInputs["publicDns"] = undefined /*out*/; resourceInputs["publicIp"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Eip.__pulumiType, name, resourceInputs, opts); } } exports.Eip = Eip; /** @internal */ Eip.__pulumiType = 'aws:ec2/eip:Eip'; //# sourceMappingURL=eip.js.map