Class CfnCapacityReservation

java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IConstruct, IDependable, IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:38.397Z") @Stability(Stable) public class CfnCapacityReservation extends CfnResource implements IInspectable
A CloudFormation AWS::EC2::CapacityReservation.

Creates a new Capacity Reservation with the specified attributes. For more information, see Capacity Reservations in the Amazon EC2 User Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.ec2.*;
 CfnCapacityReservation cfnCapacityReservation = CfnCapacityReservation.Builder.create(this, "MyCfnCapacityReservation")
         .availabilityZone("availabilityZone")
         .instanceCount(123)
         .instancePlatform("instancePlatform")
         .instanceType("instanceType")
         // the properties below are optional
         .ebsOptimized(false)
         .endDate("endDate")
         .endDateType("endDateType")
         .ephemeralStorage(false)
         .instanceMatchCriteria("instanceMatchCriteria")
         .outPostArn("outPostArn")
         .placementGroupArn("placementGroupArn")
         .tagSpecifications(List.of(TagSpecificationProperty.builder()
                 .resourceType("resourceType")
                 .tags(List.of(CfnTag.builder()
                         .key("key")
                         .value("value")
                         .build()))
                 .build()))
         .tenancy("tenancy")
         .build();
 
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnCapacityReservation

      protected CfnCapacityReservation(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnCapacityReservation

      protected CfnCapacityReservation(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnCapacityReservation

      @Stability(Stable) public CfnCapacityReservation(@NotNull Construct scope, @NotNull String id, @NotNull CfnCapacityReservationProps props)
      Create a new AWS::EC2::CapacityReservation.

      Parameters:
      scope -
      • scope in which this resource is defined.
      This parameter is required.
      id -
      • scoped id of the resource.
      This parameter is required.
      props -
      • resource properties.
      This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector -
      • tree inspector to collect and process attributes.
      This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrAvailabilityZone

      @Stability(Stable) @NotNull public String getAttrAvailabilityZone()
      Returns the Availability Zone in which the capacity is reserved.

      For example: us-east-1a .

    • getAttrAvailableInstanceCount

      @Stability(Stable) @NotNull public Number getAttrAvailableInstanceCount()
      Returns the remaining capacity, which indicates the number of instances that can be launched in the Capacity Reservation.

      For example: 9 .

    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
      The ID of the Capacity Reservation.
    • getAttrInstanceType

      @Stability(Stable) @NotNull public String getAttrInstanceType()
      Returns the type of instance for which the capacity is reserved.

      For example: m4.large .

    • getAttrTenancy

      @Stability(Stable) @NotNull public String getAttrTenancy()
      Returns the tenancy of the Capacity Reservation.

      For example: dedicated .

    • getAttrTotalInstanceCount

      @Stability(Stable) @NotNull public Number getAttrTotalInstanceCount()
      Returns the total number of instances for which the Capacity Reservation reserves capacity.

      For example: 15 .

    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getAvailabilityZone

      @Stability(Stable) @NotNull public String getAvailabilityZone()
      The Availability Zone in which to create the Capacity Reservation.
    • setAvailabilityZone

      @Stability(Stable) public void setAvailabilityZone(@NotNull String value)
      The Availability Zone in which to create the Capacity Reservation.
    • getInstanceCount

      @Stability(Stable) @NotNull public Number getInstanceCount()
      The number of instances for which to reserve capacity.

      Valid range: 1 - 1000

    • setInstanceCount

      @Stability(Stable) public void setInstanceCount(@NotNull Number value)
      The number of instances for which to reserve capacity.

      Valid range: 1 - 1000

    • getInstancePlatform

      @Stability(Stable) @NotNull public String getInstancePlatform()
      The type of operating system for which to reserve capacity.
    • setInstancePlatform

      @Stability(Stable) public void setInstancePlatform(@NotNull String value)
      The type of operating system for which to reserve capacity.
    • getInstanceType

      @Stability(Stable) @NotNull public String getInstanceType()
      The instance type for which to reserve capacity.

      For more information, see Instance types in the Amazon EC2 User Guide .

    • setInstanceType

      @Stability(Stable) public void setInstanceType(@NotNull String value)
      The instance type for which to reserve capacity.

      For more information, see Instance types in the Amazon EC2 User Guide .

    • getEbsOptimized

      @Stability(Stable) @Nullable public Object getEbsOptimized()
      Indicates whether the Capacity Reservation supports EBS-optimized instances.

      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.

    • setEbsOptimized

      @Stability(Stable) public void setEbsOptimized(@Nullable Boolean value)
      Indicates whether the Capacity Reservation supports EBS-optimized instances.

      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.

    • setEbsOptimized

      @Stability(Stable) public void setEbsOptimized(@Nullable IResolvable value)
      Indicates whether the Capacity Reservation supports EBS-optimized instances.

      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.

    • getEndDate

      @Stability(Stable) @Nullable public String getEndDate()
      The date and time at which the Capacity Reservation expires.

      When a Capacity Reservation expires, the reserved capacity is released and you can no longer launch instances into it. The Capacity Reservation's state changes to expired when it reaches its end date and time.

      You must provide an EndDate value if EndDateType is limited . Omit EndDate if EndDateType is unlimited .

      If the EndDateType is limited , the Capacity Reservation is cancelled within an hour from the specified time. For example, if you specify 5/31/2019, 13:30:55, the Capacity Reservation is guaranteed to end between 13:30:55 and 14:30:55 on 5/31/2019.

    • setEndDate

      @Stability(Stable) public void setEndDate(@Nullable String value)
      The date and time at which the Capacity Reservation expires.

      When a Capacity Reservation expires, the reserved capacity is released and you can no longer launch instances into it. The Capacity Reservation's state changes to expired when it reaches its end date and time.

      You must provide an EndDate value if EndDateType is limited . Omit EndDate if EndDateType is unlimited .

      If the EndDateType is limited , the Capacity Reservation is cancelled within an hour from the specified time. For example, if you specify 5/31/2019, 13:30:55, the Capacity Reservation is guaranteed to end between 13:30:55 and 14:30:55 on 5/31/2019.

    • getEndDateType

      @Stability(Stable) @Nullable public String getEndDateType()
      Indicates the way in which the Capacity Reservation ends.

      A Capacity Reservation can have one of the following end types:

      • unlimited - The Capacity Reservation remains active until you explicitly cancel it. Do not provide an EndDate if the EndDateType is unlimited .
      • limited - The Capacity Reservation expires automatically at a specified date and time. You must provide an EndDate value if the EndDateType value is limited .
    • setEndDateType

      @Stability(Stable) public void setEndDateType(@Nullable String value)
      Indicates the way in which the Capacity Reservation ends.

      A Capacity Reservation can have one of the following end types:

      • unlimited - The Capacity Reservation remains active until you explicitly cancel it. Do not provide an EndDate if the EndDateType is unlimited .
      • limited - The Capacity Reservation expires automatically at a specified date and time. You must provide an EndDate value if the EndDateType value is limited .
    • getEphemeralStorage

      @Stability(Stable) @Nullable public Object getEphemeralStorage()
      Deprecated..
    • setEphemeralStorage

      @Stability(Stable) public void setEphemeralStorage(@Nullable Boolean value)
      Deprecated..
    • setEphemeralStorage

      @Stability(Stable) public void setEphemeralStorage(@Nullable IResolvable value)
      Deprecated..
    • getInstanceMatchCriteria

      @Stability(Stable) @Nullable public String getInstanceMatchCriteria()
      Indicates the type of instance launches that the Capacity Reservation accepts. The options include:.

      • open - The Capacity Reservation automatically matches all instances that have matching attributes (instance type, platform, and Availability Zone). Instances that have matching attributes run in the Capacity Reservation automatically without specifying any additional parameters.
      • targeted - The Capacity Reservation only accepts instances that have matching attributes (instance type, platform, and Availability Zone), and explicitly target the Capacity Reservation. This ensures that only permitted instances can use the reserved capacity.

      Default: open

    • setInstanceMatchCriteria

      @Stability(Stable) public void setInstanceMatchCriteria(@Nullable String value)
      Indicates the type of instance launches that the Capacity Reservation accepts. The options include:.

      • open - The Capacity Reservation automatically matches all instances that have matching attributes (instance type, platform, and Availability Zone). Instances that have matching attributes run in the Capacity Reservation automatically without specifying any additional parameters.
      • targeted - The Capacity Reservation only accepts instances that have matching attributes (instance type, platform, and Availability Zone), and explicitly target the Capacity Reservation. This ensures that only permitted instances can use the reserved capacity.

      Default: open

    • getOutPostArn

      @Stability(Stable) @Nullable public String getOutPostArn()
      The Amazon Resource Name (ARN) of the Outpost on which to create the Capacity Reservation.
    • setOutPostArn

      @Stability(Stable) public void setOutPostArn(@Nullable String value)
      The Amazon Resource Name (ARN) of the Outpost on which to create the Capacity Reservation.
    • getPlacementGroupArn

      @Stability(Stable) @Nullable public String getPlacementGroupArn()
      The Amazon Resource Name (ARN) of the cluster placement group in which to create the Capacity Reservation.

      For more information, see Capacity Reservations for cluster placement groups in the Amazon EC2 User Guide .

    • setPlacementGroupArn

      @Stability(Stable) public void setPlacementGroupArn(@Nullable String value)
      The Amazon Resource Name (ARN) of the cluster placement group in which to create the Capacity Reservation.

      For more information, see Capacity Reservations for cluster placement groups in the Amazon EC2 User Guide .

    • getTagSpecifications

      @Stability(Stable) @Nullable public Object getTagSpecifications()
      The tags to apply to the Capacity Reservation during launch.
    • setTagSpecifications

      @Stability(Stable) public void setTagSpecifications(@Nullable IResolvable value)
      The tags to apply to the Capacity Reservation during launch.
    • setTagSpecifications

      @Stability(Stable) public void setTagSpecifications(@Nullable List<Object> value)
      The tags to apply to the Capacity Reservation during launch.
    • getTenancy

      @Stability(Stable) @Nullable public String getTenancy()
      Indicates the tenancy of the Capacity Reservation. A Capacity Reservation can have one of the following tenancy settings:.

      • default - The Capacity Reservation is created on hardware that is shared with other AWS accounts .
      • dedicated - The Capacity Reservation is created on single-tenant hardware that is dedicated to a single AWS account .
    • setTenancy

      @Stability(Stable) public void setTenancy(@Nullable String value)
      Indicates the tenancy of the Capacity Reservation. A Capacity Reservation can have one of the following tenancy settings:.

      • default - The Capacity Reservation is created on hardware that is shared with other AWS accounts .
      • dedicated - The Capacity Reservation is created on single-tenant hardware that is dedicated to a single AWS account .