Class Instance

    • Method Detail

      • amiLaunchIndex

        public final Integer amiLaunchIndex()

        The AMI launch index, which can be used to find this instance in the launch group.

        Returns:
        The AMI launch index, which can be used to find this instance in the launch group.
      • imageId

        public final String imageId()

        The ID of the AMI used to launch the instance.

        Returns:
        The ID of the AMI used to launch the instance.
      • instanceId

        public final String instanceId()

        The ID of the instance.

        Returns:
        The ID of the instance.
      • kernelId

        public final String kernelId()

        The kernel associated with this instance, if applicable.

        Returns:
        The kernel associated with this instance, if applicable.
      • keyName

        public final String keyName()

        The name of the key pair, if this instance was launched with an associated key pair.

        Returns:
        The name of the key pair, if this instance was launched with an associated key pair.
      • launchTime

        public final Instant launchTime()

        The time the instance was launched.

        Returns:
        The time the instance was launched.
      • monitoring

        public final Monitoring monitoring()

        The monitoring for the instance.

        Returns:
        The monitoring for the instance.
      • placement

        public final Placement placement()

        The location where the instance launched, if applicable.

        Returns:
        The location where the instance launched, if applicable.
      • platform

        public final PlatformValues platform()

        The platform. This value is windows for Windows instances; otherwise, it is empty.

        If the service returns an enum value that is not available in the current SDK version, platform will return PlatformValues.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from platformAsString().

        Returns:
        The platform. This value is windows for Windows instances; otherwise, it is empty.
        See Also:
        PlatformValues
      • platformAsString

        public final String platformAsString()

        The platform. This value is windows for Windows instances; otherwise, it is empty.

        If the service returns an enum value that is not available in the current SDK version, platform will return PlatformValues.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from platformAsString().

        Returns:
        The platform. This value is windows for Windows instances; otherwise, it is empty.
        See Also:
        PlatformValues
      • privateDnsName

        public final String privateDnsName()

        [IPv4 only] The private DNS hostname name assigned to the instance. This DNS hostname can only be used inside the Amazon EC2 network. This name is not available until the instance enters the running state.

        The Amazon-provided DNS server resolves Amazon-provided private DNS hostnames if you've enabled DNS resolution and DNS hostnames in your VPC. If you are not using the Amazon-provided DNS server in your VPC, your custom domain name servers must resolve the hostname as appropriate.

        Returns:
        [IPv4 only] The private DNS hostname name assigned to the instance. This DNS hostname can only be used inside the Amazon EC2 network. This name is not available until the instance enters the running state.

        The Amazon-provided DNS server resolves Amazon-provided private DNS hostnames if you've enabled DNS resolution and DNS hostnames in your VPC. If you are not using the Amazon-provided DNS server in your VPC, your custom domain name servers must resolve the hostname as appropriate.

      • privateIpAddress

        public final String privateIpAddress()

        The private IPv4 address assigned to the instance.

        Returns:
        The private IPv4 address assigned to the instance.
      • hasProductCodes

        public final boolean hasProductCodes()
        For responses, this returns true if the service returned a value for the ProductCodes property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
      • productCodes

        public final List<ProductCode> productCodes()

        The product codes attached to this instance, if applicable.

        Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

        This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasProductCodes() method.

        Returns:
        The product codes attached to this instance, if applicable.
      • publicDnsName

        public final String publicDnsName()

        [IPv4 only] The public DNS name assigned to the instance. This name is not available until the instance enters the running state. This name is only available if you've enabled DNS hostnames for your VPC.

        Returns:
        [IPv4 only] The public DNS name assigned to the instance. This name is not available until the instance enters the running state. This name is only available if you've enabled DNS hostnames for your VPC.
      • publicIpAddress

        public final String publicIpAddress()

        The public IPv4 address, or the Carrier IP address assigned to the instance, if applicable.

        A Carrier IP address only applies to an instance launched in a subnet associated with a Wavelength Zone.

        Returns:
        The public IPv4 address, or the Carrier IP address assigned to the instance, if applicable.

        A Carrier IP address only applies to an instance launched in a subnet associated with a Wavelength Zone.

      • ramdiskId

        public final String ramdiskId()

        The RAM disk associated with this instance, if applicable.

        Returns:
        The RAM disk associated with this instance, if applicable.
      • state

        public final InstanceState state()

        The current state of the instance.

        Returns:
        The current state of the instance.
      • stateTransitionReason

        public final String stateTransitionReason()

        The reason for the most recent state transition. This might be an empty string.

        Returns:
        The reason for the most recent state transition. This might be an empty string.
      • subnetId

        public final String subnetId()

        The ID of the subnet in which the instance is running.

        Returns:
        The ID of the subnet in which the instance is running.
      • vpcId

        public final String vpcId()

        The ID of the VPC in which the instance is running.

        Returns:
        The ID of the VPC in which the instance is running.
      • hasBlockDeviceMappings

        public final boolean hasBlockDeviceMappings()
        For responses, this returns true if the service returned a value for the BlockDeviceMappings property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
      • blockDeviceMappings

        public final List<InstanceBlockDeviceMapping> blockDeviceMappings()

        Any block device mapping entries for the instance.

        Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

        This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasBlockDeviceMappings() method.

        Returns:
        Any block device mapping entries for the instance.
      • clientToken

        public final String clientToken()

        The idempotency token you provided when you launched the instance, if applicable.

        Returns:
        The idempotency token you provided when you launched the instance, if applicable.
      • ebsOptimized

        public final Boolean ebsOptimized()

        Indicates whether the instance is optimized for Amazon EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS Optimized instance.

        Returns:
        Indicates whether the instance is optimized for Amazon EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS Optimized instance.
      • enaSupport

        public final Boolean enaSupport()

        Specifies whether enhanced networking with ENA is enabled.

        Returns:
        Specifies whether enhanced networking with ENA is enabled.
      • hypervisor

        public final HypervisorType hypervisor()

        The hypervisor type of the instance. The value xen is used for both Xen and Nitro hypervisors.

        If the service returns an enum value that is not available in the current SDK version, hypervisor will return HypervisorType.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from hypervisorAsString().

        Returns:
        The hypervisor type of the instance. The value xen is used for both Xen and Nitro hypervisors.
        See Also:
        HypervisorType
      • hypervisorAsString

        public final String hypervisorAsString()

        The hypervisor type of the instance. The value xen is used for both Xen and Nitro hypervisors.

        If the service returns an enum value that is not available in the current SDK version, hypervisor will return HypervisorType.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from hypervisorAsString().

        Returns:
        The hypervisor type of the instance. The value xen is used for both Xen and Nitro hypervisors.
        See Also:
        HypervisorType
      • iamInstanceProfile

        public final IamInstanceProfile iamInstanceProfile()

        The IAM instance profile associated with the instance, if applicable.

        Returns:
        The IAM instance profile associated with the instance, if applicable.
      • hasElasticGpuAssociations

        public final boolean hasElasticGpuAssociations()
        For responses, this returns true if the service returned a value for the ElasticGpuAssociations property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
      • elasticGpuAssociations

        public final List<ElasticGpuAssociation> elasticGpuAssociations()

        Deprecated.

        Amazon Elastic Graphics reached end of life on January 8, 2024. For workloads that require graphics acceleration, we recommend that you use Amazon EC2 G4ad, G4dn, or G5 instances.

        Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

        This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasElasticGpuAssociations() method.

        Returns:
        Deprecated.

        Amazon Elastic Graphics reached end of life on January 8, 2024. For workloads that require graphics acceleration, we recommend that you use Amazon EC2 G4ad, G4dn, or G5 instances.

      • hasElasticInferenceAcceleratorAssociations

        public final boolean hasElasticInferenceAcceleratorAssociations()
        For responses, this returns true if the service returned a value for the ElasticInferenceAcceleratorAssociations property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
      • elasticInferenceAcceleratorAssociations

        public final List<ElasticInferenceAcceleratorAssociation> elasticInferenceAcceleratorAssociations()

        The elastic inference accelerator associated with the instance.

        Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

        This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasElasticInferenceAcceleratorAssociations() method.

        Returns:
        The elastic inference accelerator associated with the instance.
      • hasNetworkInterfaces

        public final boolean hasNetworkInterfaces()
        For responses, this returns true if the service returned a value for the NetworkInterfaces property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
      • networkInterfaces

        public final List<InstanceNetworkInterface> networkInterfaces()

        The network interfaces for the instance.

        Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

        This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasNetworkInterfaces() method.

        Returns:
        The network interfaces for the instance.
      • outpostArn

        public final String outpostArn()

        The Amazon Resource Name (ARN) of the Outpost.

        Returns:
        The Amazon Resource Name (ARN) of the Outpost.
      • rootDeviceName

        public final String rootDeviceName()

        The device name of the root device volume (for example, /dev/sda1).

        Returns:
        The device name of the root device volume (for example, /dev/sda1).
      • rootDeviceType

        public final DeviceType rootDeviceType()

        The root device type used by the AMI. The AMI can use an EBS volume or an instance store volume.

        If the service returns an enum value that is not available in the current SDK version, rootDeviceType will return DeviceType.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from rootDeviceTypeAsString().

        Returns:
        The root device type used by the AMI. The AMI can use an EBS volume or an instance store volume.
        See Also:
        DeviceType
      • rootDeviceTypeAsString

        public final String rootDeviceTypeAsString()

        The root device type used by the AMI. The AMI can use an EBS volume or an instance store volume.

        If the service returns an enum value that is not available in the current SDK version, rootDeviceType will return DeviceType.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from rootDeviceTypeAsString().

        Returns:
        The root device type used by the AMI. The AMI can use an EBS volume or an instance store volume.
        See Also:
        DeviceType
      • hasSecurityGroups

        public final boolean hasSecurityGroups()
        For responses, this returns true if the service returned a value for the SecurityGroups property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
      • securityGroups

        public final List<GroupIdentifier> securityGroups()

        The security groups for the instance.

        Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

        This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasSecurityGroups() method.

        Returns:
        The security groups for the instance.
      • sourceDestCheck

        public final Boolean sourceDestCheck()

        Indicates whether source/destination checking is enabled.

        Returns:
        Indicates whether source/destination checking is enabled.
      • spotInstanceRequestId

        public final String spotInstanceRequestId()

        If the request is a Spot Instance request, the ID of the request.

        Returns:
        If the request is a Spot Instance request, the ID of the request.
      • sriovNetSupport

        public final String sriovNetSupport()

        Specifies whether enhanced networking with the Intel 82599 Virtual Function interface is enabled.

        Returns:
        Specifies whether enhanced networking with the Intel 82599 Virtual Function interface is enabled.
      • stateReason

        public final StateReason stateReason()

        The reason for the most recent state transition.

        Returns:
        The reason for the most recent state transition.
      • hasTags

        public final boolean hasTags()
        For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
      • tags

        public final List<Tag> tags()

        Any tags assigned to the instance.

        Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

        This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasTags() method.

        Returns:
        Any tags assigned to the instance.
      • cpuOptions

        public final CpuOptions cpuOptions()

        The CPU options for the instance.

        Returns:
        The CPU options for the instance.
      • capacityReservationId

        public final String capacityReservationId()

        The ID of the Capacity Reservation.

        Returns:
        The ID of the Capacity Reservation.
      • capacityReservationSpecification

        public final CapacityReservationSpecificationResponse capacityReservationSpecification()

        Information about the Capacity Reservation targeting option.

        Returns:
        Information about the Capacity Reservation targeting option.
      • hibernationOptions

        public final HibernationOptions hibernationOptions()

        Indicates whether the instance is enabled for hibernation.

        Returns:
        Indicates whether the instance is enabled for hibernation.
      • hasLicenses

        public final boolean hasLicenses()
        For responses, this returns true if the service returned a value for the Licenses property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
      • licenses

        public final List<LicenseConfiguration> licenses()

        The license configurations for the instance.

        Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

        This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasLicenses() method.

        Returns:
        The license configurations for the instance.
      • metadataOptions

        public final InstanceMetadataOptionsResponse metadataOptions()

        The metadata options for the instance.

        Returns:
        The metadata options for the instance.
      • enclaveOptions

        public final EnclaveOptions enclaveOptions()

        Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves.

        Returns:
        Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves.
      • bootMode

        public final BootModeValues bootMode()

        The boot mode that was specified by the AMI. If the value is uefi-preferred, the AMI supports both UEFI and Legacy BIOS. The currentInstanceBootMode parameter is the boot mode that is used to boot the instance at launch or start.

        The operating system contained in the AMI must be configured to support the specified boot mode.

        For more information, see Boot modes in the Amazon EC2 User Guide.

        If the service returns an enum value that is not available in the current SDK version, bootMode will return BootModeValues.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from bootModeAsString().

        Returns:
        The boot mode that was specified by the AMI. If the value is uefi-preferred, the AMI supports both UEFI and Legacy BIOS. The currentInstanceBootMode parameter is the boot mode that is used to boot the instance at launch or start.

        The operating system contained in the AMI must be configured to support the specified boot mode.

        For more information, see Boot modes in the Amazon EC2 User Guide.

        See Also:
        BootModeValues
      • bootModeAsString

        public final String bootModeAsString()

        The boot mode that was specified by the AMI. If the value is uefi-preferred, the AMI supports both UEFI and Legacy BIOS. The currentInstanceBootMode parameter is the boot mode that is used to boot the instance at launch or start.

        The operating system contained in the AMI must be configured to support the specified boot mode.

        For more information, see Boot modes in the Amazon EC2 User Guide.

        If the service returns an enum value that is not available in the current SDK version, bootMode will return BootModeValues.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from bootModeAsString().

        Returns:
        The boot mode that was specified by the AMI. If the value is uefi-preferred, the AMI supports both UEFI and Legacy BIOS. The currentInstanceBootMode parameter is the boot mode that is used to boot the instance at launch or start.

        The operating system contained in the AMI must be configured to support the specified boot mode.

        For more information, see Boot modes in the Amazon EC2 User Guide.

        See Also:
        BootModeValues
      • platformDetails

        public final String platformDetails()

        The platform details value for the instance. For more information, see AMI billing information fields in the Amazon EC2 User Guide.

        Returns:
        The platform details value for the instance. For more information, see AMI billing information fields in the Amazon EC2 User Guide.
      • usageOperationUpdateTime

        public final Instant usageOperationUpdateTime()

        The time that the usage operation was last updated.

        Returns:
        The time that the usage operation was last updated.
      • privateDnsNameOptions

        public final PrivateDnsNameOptionsResponse privateDnsNameOptions()

        The options for the instance hostname.

        Returns:
        The options for the instance hostname.
      • ipv6Address

        public final String ipv6Address()

        The IPv6 address assigned to the instance.

        Returns:
        The IPv6 address assigned to the instance.
      • tpmSupport

        public final String tpmSupport()

        If the instance is configured for NitroTPM support, the value is v2.0. For more information, see NitroTPM in the Amazon EC2 User Guide.

        Returns:
        If the instance is configured for NitroTPM support, the value is v2.0. For more information, see NitroTPM in the Amazon EC2 User Guide.
      • maintenanceOptions

        public final InstanceMaintenanceOptions maintenanceOptions()

        Provides information on the recovery and maintenance options of your instance.

        Returns:
        Provides information on the recovery and maintenance options of your instance.
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • toString

        public final String toString()
        Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
        Overrides:
        toString in class Object
      • getValueForField

        public final <T> Optional<T> getValueForField​(String fieldName,
                                                      Class<T> clazz)