Package com.pulumi.aws.ec2
Class Instance
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.ec2.Instance
-
public class Instance extends com.pulumi.resources.CustomResource
Provides an EC2 instance resource. This allows instances to be created, updated, and deleted. ## Example Usage ### Basic example using AMI lookup <!--Start PulumiCodeChooser -->package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.Ec2Functions; import com.pulumi.aws.ec2.inputs.GetAmiArgs; import com.pulumi.aws.ec2.Instance; import com.pulumi.aws.ec2.InstanceArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { final var ubuntu = Ec2Functions.getAmi(GetAmiArgs.builder() .mostRecent(true) .filters( GetAmiFilterArgs.builder() .name("name") .values("ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*") .build(), GetAmiFilterArgs.builder() .name("virtualization-type") .values("hvm") .build()) .owners("099720109477") .build()); var web = new Instance("web", InstanceArgs.builder() .ami(ubuntu.applyValue(getAmiResult -> getAmiResult.id())) .instanceType("t3.micro") .tags(Map.of("Name", "HelloWorld")) .build()); } }
package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.Ec2Functions; import com.pulumi.aws.ec2.inputs.GetAmiArgs; import com.pulumi.aws.ec2.Instance; import com.pulumi.aws.ec2.InstanceArgs; import com.pulumi.aws.ec2.inputs.InstanceInstanceMarketOptionsArgs; import com.pulumi.aws.ec2.inputs.InstanceInstanceMarketOptionsSpotOptionsArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { final var this = Ec2Functions.getAmi(GetAmiArgs.builder() .mostRecent(true) .owners("amazon") .filters( GetAmiFilterArgs.builder() .name("architecture") .values("arm64") .build(), GetAmiFilterArgs.builder() .name("name") .values("al2023-ami-2023*") .build()) .build()); var thisInstance = new Instance("thisInstance", InstanceArgs.builder() .ami(this_.id()) .instanceMarketOptions(InstanceInstanceMarketOptionsArgs.builder() .spotOptions(InstanceInstanceMarketOptionsSpotOptionsArgs.builder() .maxPrice(0.0031) .build()) .build()) .instanceType("t4g.nano") .tags(Map.of("Name", "test-spot")) .build()); } }
package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.Vpc; import com.pulumi.aws.ec2.VpcArgs; import com.pulumi.aws.ec2.Subnet; import com.pulumi.aws.ec2.SubnetArgs; import com.pulumi.aws.ec2.NetworkInterface; import com.pulumi.aws.ec2.NetworkInterfaceArgs; import com.pulumi.aws.ec2.Instance; import com.pulumi.aws.ec2.InstanceArgs; import com.pulumi.aws.ec2.inputs.InstanceNetworkInterfaceArgs; import com.pulumi.aws.ec2.inputs.InstanceCreditSpecificationArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var myVpc = new Vpc("myVpc", VpcArgs.builder() .cidrBlock("172.16.0.0/16") .tags(Map.of("Name", "tf-example")) .build()); var mySubnet = new Subnet("mySubnet", SubnetArgs.builder() .vpcId(myVpc.id()) .cidrBlock("172.16.10.0/24") .availabilityZone("us-west-2a") .tags(Map.of("Name", "tf-example")) .build()); var foo = new NetworkInterface("foo", NetworkInterfaceArgs.builder() .subnetId(mySubnet.id()) .privateIps("172.16.10.100") .tags(Map.of("Name", "primary_network_interface")) .build()); var fooInstance = new Instance("fooInstance", InstanceArgs.builder() .ami("ami-005e54dee72cc1d00") .instanceType("t2.micro") .networkInterfaces(InstanceNetworkInterfaceArgs.builder() .networkInterfaceId(foo.id()) .deviceIndex(0) .build()) .creditSpecification(InstanceCreditSpecificationArgs.builder() .cpuCredits("unlimited") .build()) .build()); } }
package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.Vpc; import com.pulumi.aws.ec2.VpcArgs; import com.pulumi.aws.ec2.Subnet; import com.pulumi.aws.ec2.SubnetArgs; import com.pulumi.aws.ec2.Ec2Functions; import com.pulumi.aws.ec2.inputs.GetAmiArgs; import com.pulumi.aws.ec2.Instance; import com.pulumi.aws.ec2.InstanceArgs; import com.pulumi.aws.ec2.inputs.InstanceCpuOptionsArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var example = new Vpc("example", VpcArgs.builder() .cidrBlock("172.16.0.0/16") .tags(Map.of("Name", "tf-example")) .build()); var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder() .vpcId(example.id()) .cidrBlock("172.16.10.0/24") .availabilityZone("us-east-2a") .tags(Map.of("Name", "tf-example")) .build()); final var amzn-linux-2023-ami = Ec2Functions.getAmi(GetAmiArgs.builder() .mostRecent(true) .owners("amazon") .filters(GetAmiFilterArgs.builder() .name("name") .values("al2023-ami-2023.*-x86_64") .build()) .build()); var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder() .ami(amzn_linux_2023_ami.id()) .instanceType("c6a.2xlarge") .subnetId(exampleSubnet.id()) .cpuOptions(InstanceCpuOptionsArgs.builder() .coreCount(2) .threadsPerCore(2) .build()) .tags(Map.of("Name", "tf-example")) .build()); } }
package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.Instance; import com.pulumi.aws.ec2.InstanceArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var this_ = new Instance("this", InstanceArgs.builder() .ami("ami-0dcc1e21636832c5d") .instanceType("m5.large") .hostResourceGroupArn("arn:aws:resource-groups:us-west-2:012345678901:group/win-testhost") .tenancy("host") .build()); } }
-
-
Constructor Summary
Constructors Constructor Description Instance(java.lang.String name)
Instance(java.lang.String name, InstanceArgs args)
Instance(java.lang.String name, InstanceArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>
ami()
com.pulumi.core.Output<java.lang.String>
arn()
com.pulumi.core.Output<java.lang.Boolean>
associatePublicIpAddress()
com.pulumi.core.Output<java.lang.String>
availabilityZone()
com.pulumi.core.Output<InstanceCapacityReservationSpecification>
capacityReservationSpecification()
com.pulumi.core.Output<java.lang.Integer>
cpuCoreCount()
com.pulumi.core.Output<InstanceCpuOptions>
cpuOptions()
com.pulumi.core.Output<java.lang.Integer>
cpuThreadsPerCore()
com.pulumi.core.Output<java.util.Optional<InstanceCreditSpecification>>
creditSpecification()
com.pulumi.core.Output<java.lang.Boolean>
disableApiStop()
com.pulumi.core.Output<java.lang.Boolean>
disableApiTermination()
com.pulumi.core.Output<java.util.List<InstanceEbsBlockDevice>>
ebsBlockDevices()
com.pulumi.core.Output<java.lang.Boolean>
ebsOptimized()
com.pulumi.core.Output<InstanceEnclaveOptions>
enclaveOptions()
com.pulumi.core.Output<java.util.List<InstanceEphemeralBlockDevice>>
ephemeralBlockDevices()
static Instance
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, InstanceState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>
getPasswordData()
com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>
hibernation()
com.pulumi.core.Output<java.lang.String>
hostId()
com.pulumi.core.Output<java.lang.String>
hostResourceGroupArn()
com.pulumi.core.Output<java.lang.String>
iamInstanceProfile()
com.pulumi.core.Output<java.lang.String>
instanceInitiatedShutdownBehavior()
com.pulumi.core.Output<java.lang.String>
instanceLifecycle()
com.pulumi.core.Output<InstanceInstanceMarketOptions>
instanceMarketOptions()
com.pulumi.core.Output<java.lang.String>
instanceState()
com.pulumi.core.Output<java.lang.String>
instanceType()
com.pulumi.core.Output<java.lang.Integer>
ipv6AddressCount()
com.pulumi.core.Output<java.util.List<java.lang.String>>
ipv6Addresses()
com.pulumi.core.Output<java.lang.String>
keyName()
com.pulumi.core.Output<java.util.Optional<InstanceLaunchTemplate>>
launchTemplate()
com.pulumi.core.Output<InstanceMaintenanceOptions>
maintenanceOptions()
com.pulumi.core.Output<InstanceMetadataOptions>
metadataOptions()
com.pulumi.core.Output<java.lang.Boolean>
monitoring()
com.pulumi.core.Output<java.util.List<InstanceNetworkInterface>>
networkInterfaces()
com.pulumi.core.Output<java.lang.String>
outpostArn()
com.pulumi.core.Output<java.lang.String>
passwordData()
com.pulumi.core.Output<java.lang.String>
placementGroup()
com.pulumi.core.Output<java.lang.Integer>
placementPartitionNumber()
com.pulumi.core.Output<java.lang.String>
primaryNetworkInterfaceId()
com.pulumi.core.Output<java.lang.String>
privateDns()
com.pulumi.core.Output<InstancePrivateDnsNameOptions>
privateDnsNameOptions()
com.pulumi.core.Output<java.lang.String>
privateIp()
com.pulumi.core.Output<java.lang.String>
publicDns()
com.pulumi.core.Output<java.lang.String>
publicIp()
com.pulumi.core.Output<InstanceRootBlockDevice>
rootBlockDevice()
com.pulumi.core.Output<java.util.List<java.lang.String>>
secondaryPrivateIps()
com.pulumi.core.Output<java.util.List<java.lang.String>>
securityGroups()
com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>
sourceDestCheck()
com.pulumi.core.Output<java.lang.String>
spotInstanceRequestId()
com.pulumi.core.Output<java.lang.String>
subnetId()
com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>
tags()
com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>
tagsAll()
com.pulumi.core.Output<java.lang.String>
tenancy()
com.pulumi.core.Output<java.lang.String>
userData()
com.pulumi.core.Output<java.lang.String>
userDataBase64()
com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>
userDataReplaceOnChange()
com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>
volumeTags()
com.pulumi.core.Output<java.util.List<java.lang.String>>
vpcSecurityGroupIds()
-
-
-
Constructor Detail
-
Instance
public Instance(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
Instance
public Instance(java.lang.String name, @Nullable InstanceArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
Instance
public Instance(java.lang.String name, @Nullable InstanceArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
ami
public com.pulumi.core.Output<java.lang.String> ami()
- Returns:
- AMI to use for the instance. Required unless `launch_template` is specified and the Launch Template specifes an AMI. If an AMI is specified in the Launch Template, setting `ami` will override the AMI specified in the Launch Template.
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- ARN of the instance.
-
associatePublicIpAddress
public com.pulumi.core.Output<java.lang.Boolean> associatePublicIpAddress()
- Returns:
- Whether to associate a public IP address with an instance in a VPC.
-
availabilityZone
public com.pulumi.core.Output<java.lang.String> availabilityZone()
- Returns:
- AZ to start the instance in.
-
capacityReservationSpecification
public com.pulumi.core.Output<InstanceCapacityReservationSpecification> capacityReservationSpecification()
- Returns:
- Describes an instance's Capacity Reservation targeting option. See Capacity Reservation Specification below for more details. > **NOTE:** Changing `cpu_core_count` and/or `cpu_threads_per_core` will cause the resource to be destroyed and re-created.
-
cpuCoreCount
public com.pulumi.core.Output<java.lang.Integer> cpuCoreCount()
- Returns:
- Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options [CPU Cores and Threads Per CPU Core Per Instance Type](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html#cpu-options-supported-instances-values) - specifying this option for unsupported instance types will return an error from the EC2 API.
-
cpuOptions
public com.pulumi.core.Output<InstanceCpuOptions> cpuOptions()
- Returns:
- The CPU options for the instance. See CPU Options below for more details.
-
cpuThreadsPerCore
public com.pulumi.core.Output<java.lang.Integer> cpuThreadsPerCore()
- Returns:
- If set to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See [Optimizing CPU Options](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) for more information.
-
creditSpecification
public com.pulumi.core.Output<java.util.Optional<InstanceCreditSpecification>> creditSpecification()
- Returns:
- Configuration block for customizing the credit specification of the instance. See Credit Specification below for more details. This provider will only perform drift detection of its value when present in a configuration. Removing this configuration on existing instances will only stop managing it. It will not change the configuration back to the default for the instance type.
-
disableApiStop
public com.pulumi.core.Output<java.lang.Boolean> disableApiStop()
- Returns:
- If true, enables [EC2 Instance Stop Protection](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html#Using_StopProtection).
-
disableApiTermination
public com.pulumi.core.Output<java.lang.Boolean> disableApiTermination()
- Returns:
- If true, enables [EC2 Instance Termination Protection](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingDisableAPITermination).
-
ebsBlockDevices
public com.pulumi.core.Output<java.util.List<InstanceEbsBlockDevice>> ebsBlockDevices()
- Returns:
- One or more configuration blocks with additional EBS block devices to attach to the instance. Block device configurations only apply on resource creation. See Block Devices below for details on attributes and drift detection. When accessing this as an attribute reference, it is a set of objects.
-
ebsOptimized
public com.pulumi.core.Output<java.lang.Boolean> ebsOptimized()
- Returns:
- If true, the launched EC2 instance will be EBS-optimized. Note that if this is not set on an instance type that is optimized by default then this will show as disabled but if the instance type is optimized by default then there is no need to set this and there is no effect to disabling it. See the [EBS Optimized section](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html) of the AWS User Guide for more information.
-
enclaveOptions
public com.pulumi.core.Output<InstanceEnclaveOptions> enclaveOptions()
- Returns:
- Enable Nitro Enclaves on launched instances. See Enclave Options below for more details.
-
ephemeralBlockDevices
public com.pulumi.core.Output<java.util.List<InstanceEphemeralBlockDevice>> ephemeralBlockDevices()
- Returns:
- One or more configuration blocks to customize Ephemeral (also known as "Instance Store") volumes on the instance. See Block Devices below for details. When accessing this as an attribute reference, it is a set of objects.
-
getPasswordData
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> getPasswordData()
- Returns:
- If true, wait for password data to become available and retrieve it. Useful for getting the administrator password for instances running Microsoft Windows. The password data is exported to the `password_data` attribute. See [GetPasswordData](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_GetPasswordData.html) for more information.
-
hibernation
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> hibernation()
- Returns:
- If true, the launched EC2 instance will support hibernation.
-
hostId
public com.pulumi.core.Output<java.lang.String> hostId()
- Returns:
- ID of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host.
-
hostResourceGroupArn
public com.pulumi.core.Output<java.lang.String> hostResourceGroupArn()
- Returns:
- ARN of the host resource group in which to launch the instances. If you specify an ARN, omit the `tenancy` parameter or set it to `host`.
-
iamInstanceProfile
public com.pulumi.core.Output<java.lang.String> iamInstanceProfile()
- Returns:
- IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. Ensure your credentials have the correct permission to assign the instance profile according to the [EC2 documentation](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html#roles-usingrole-ec2instance-permissions), notably `iam:PassRole`.
-
instanceInitiatedShutdownBehavior
public com.pulumi.core.Output<java.lang.String> instanceInitiatedShutdownBehavior()
- Returns:
- Shutdown behavior for the instance. Amazon defaults this to `stop` for EBS-backed instances and `terminate` for instance-store instances. Cannot be set on instance-store instances. See [Shutdown Behavior](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingInstanceInitiatedShutdownBehavior) for more information.
-
instanceLifecycle
public com.pulumi.core.Output<java.lang.String> instanceLifecycle()
- Returns:
- Indicates whether this is a Spot Instance or a Scheduled Instance.
-
instanceMarketOptions
public com.pulumi.core.Output<InstanceInstanceMarketOptions> instanceMarketOptions()
- Returns:
- Describes the market (purchasing) option for the instances. See Market Options below for details on attributes.
-
instanceState
public com.pulumi.core.Output<java.lang.String> instanceState()
- Returns:
- State of the instance. One of: `pending`, `running`, `shutting-down`, `terminated`, `stopping`, `stopped`. See [Instance Lifecycle](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) for more information.
-
instanceType
public com.pulumi.core.Output<java.lang.String> instanceType()
- Returns:
- Instance type to use for the instance. Required unless `launch_template` is specified and the Launch Template specifies an instance type. If an instance type is specified in the Launch Template, setting `instance_type` will override the instance type specified in the Launch Template. Updates to this field will trigger a stop/start of the EC2 instance.
-
ipv6AddressCount
public com.pulumi.core.Output<java.lang.Integer> ipv6AddressCount()
- Returns:
- Number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
-
ipv6Addresses
public com.pulumi.core.Output<java.util.List<java.lang.String>> ipv6Addresses()
- Returns:
- Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
-
keyName
public com.pulumi.core.Output<java.lang.String> keyName()
- Returns:
- Key name of the Key Pair to use for the instance; which can be managed using the `aws.ec2.KeyPair` resource.
-
launchTemplate
public com.pulumi.core.Output<java.util.Optional<InstanceLaunchTemplate>> launchTemplate()
- Returns:
- Specifies a Launch Template to configure the instance. Parameters configured on this resource will override the corresponding parameters in the Launch Template. See Launch Template Specification below for more details.
-
maintenanceOptions
public com.pulumi.core.Output<InstanceMaintenanceOptions> maintenanceOptions()
- Returns:
- Maintenance and recovery options for the instance. See Maintenance Options below for more details.
-
metadataOptions
public com.pulumi.core.Output<InstanceMetadataOptions> metadataOptions()
- Returns:
- Customize the metadata options of the instance. See Metadata Options below for more details.
-
monitoring
public com.pulumi.core.Output<java.lang.Boolean> monitoring()
- Returns:
- If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
-
networkInterfaces
public com.pulumi.core.Output<java.util.List<InstanceNetworkInterface>> networkInterfaces()
- Returns:
- Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
-
outpostArn
public com.pulumi.core.Output<java.lang.String> outpostArn()
- Returns:
- ARN of the Outpost the instance is assigned to.
-
passwordData
public com.pulumi.core.Output<java.lang.String> passwordData()
- Returns:
- Base-64 encoded encrypted password data for the instance. Useful for getting the administrator password for instances running Microsoft Windows. This attribute is only exported if `get_password_data` is true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See [GetPasswordData](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_GetPasswordData.html) for more information.
-
placementGroup
public com.pulumi.core.Output<java.lang.String> placementGroup()
- Returns:
- Placement Group to start the instance in.
-
placementPartitionNumber
public com.pulumi.core.Output<java.lang.Integer> placementPartitionNumber()
- Returns:
- Number of the partition the instance is in. Valid only if the `aws.ec2.PlacementGroup` resource's `strategy` argument is set to `"partition"`.
-
primaryNetworkInterfaceId
public com.pulumi.core.Output<java.lang.String> primaryNetworkInterfaceId()
- Returns:
- ID of the instance's primary network interface.
-
privateDns
public com.pulumi.core.Output<java.lang.String> privateDns()
- Returns:
- Private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you've enabled DNS hostnames for your VPC.
-
privateDnsNameOptions
public com.pulumi.core.Output<InstancePrivateDnsNameOptions> privateDnsNameOptions()
- Returns:
- Options for the instance hostname. The default values are inherited from the subnet. See Private DNS Name Options below for more details.
-
privateIp
public com.pulumi.core.Output<java.lang.String> privateIp()
- Returns:
- Private IP address to associate with the instance in a VPC.
-
publicDns
public com.pulumi.core.Output<java.lang.String> publicDns()
- Returns:
- Public DNS name assigned to the instance. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC.
-
publicIp
public com.pulumi.core.Output<java.lang.String> publicIp()
- Returns:
- Public IP address assigned to the instance, if applicable. **NOTE**: If you are using an `aws.ec2.Eip` with your instance, you should refer to the EIP's address directly and not use `public_ip` as this field will change after the EIP is attached.
-
rootBlockDevice
public com.pulumi.core.Output<InstanceRootBlockDevice> rootBlockDevice()
- Returns:
- Configuration block to customize details about the root block device of the instance. See Block Devices below for details. When accessing this as an attribute reference, it is a list containing one object.
-
secondaryPrivateIps
public com.pulumi.core.Output<java.util.List<java.lang.String>> secondaryPrivateIps()
- Returns:
- List of secondary private IPv4 addresses to assign to the instance's primary network interface (eth0) in a VPC. Can only be assigned to the primary network interface (eth0) attached at instance creation, not a pre-existing network interface i.e., referenced in a `network_interface` block. Refer to the [Elastic network interfaces documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI) to see the maximum number of private IP addresses allowed per instance type.
-
securityGroups
public com.pulumi.core.Output<java.util.List<java.lang.String>> securityGroups()
- Returns:
- List of security group names to associate with. > **NOTE:** If you are creating Instances in a VPC, use `vpc_security_group_ids` instead.
-
sourceDestCheck
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> sourceDestCheck()
- Returns:
- Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
-
spotInstanceRequestId
public com.pulumi.core.Output<java.lang.String> spotInstanceRequestId()
- Returns:
- If the request is a Spot Instance request, the ID of the request.
-
subnetId
public com.pulumi.core.Output<java.lang.String> subnetId()
- Returns:
- VPC Subnet ID to launch in.
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- Map of tags to assign to the resource. Note that these tags apply to the instance and not block storage devices. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- Map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
-
tenancy
public com.pulumi.core.Output<java.lang.String> tenancy()
- Returns:
- Tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of `dedicated` runs on single-tenant hardware. The `host` tenancy is not supported for the import-instance command. Valid values are `default`, `dedicated`, and `host`.
-
userData
public com.pulumi.core.Output<java.lang.String> userData()
- Returns:
- User data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see `user_data_base64` instead. Updates to this field will trigger a stop/start of the EC2 instance by default. If the `user_data_replace_on_change` is set then updates to this field will trigger a destroy and recreate.
-
userDataBase64
public com.pulumi.core.Output<java.lang.String> userDataBase64()
- Returns:
- Can be used instead of `user_data` to pass base64-encoded binary data directly. Use this instead of `user_data` whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption. Updates to this field will trigger a stop/start of the EC2 instance by default. If the `user_data_replace_on_change` is set then updates to this field will trigger a destroy and recreate.
-
userDataReplaceOnChange
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> userDataReplaceOnChange()
- Returns:
- When used in combination with `user_data` or `user_data_base64` will trigger a destroy and recreate when set to `true`. Defaults to `false` if not set.
-
volumeTags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> volumeTags()
- Returns:
- Map of tags to assign, at instance-creation time, to root and EBS volumes. > **NOTE:** Do not use `volume_tags` if you plan to manage block device tags outside the `aws.ec2.Instance` configuration, such as using `tags` in an `aws.ebs.Volume` resource attached via `aws.ec2.VolumeAttachment`. Doing so will result in resource cycling and inconsistent behavior.
-
vpcSecurityGroupIds
public com.pulumi.core.Output<java.util.List<java.lang.String>> vpcSecurityGroupIds()
- Returns:
- List of security group IDs to associate with.
-
get
public static Instance get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable InstanceState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-