Launch instances into Capacity Blocks - Amazon Elastic Compute Cloud

Launch instances into Capacity Blocks

To use your Capacity Block, you must specify the Capacity Block reservation ID when launching instances. Launching an instance into a Capacity Block reduces the available capacity by the number of instances launched. For example, if your purchased instance capacity is eight instances and you launch four instances, the available capacity is reduced by four.

If you terminate an instance running in the Capacity Block before the reservation ends, you can launch a new instance in its place. When you stop or terminate an instance in a Capacity Block, it takes several minutes to clean up your instance before you can launch another instance to replace it. During this time, your instance will be in a stopping or shutting-down state. After this process is complete, your instance state will change to stopped or terminated. Then, the available capacity in your Capacity Block will update to show another instance available to use.

For information about how to set up an EKS managed node group with a Capacity Block, see Create a managed node group with Capacity Blocks for ML in the Amazon EKS User Guide.

For information about how to set up AWS ParallelCluster using a Capacity Block, see ML on AWS ParallelCluster.

For information about how to launch instances into a Capacity Block using EC2 Fleet, see Tutorial: Configure your EC2 Fleet to launch instances into Capacity Blocks.

For information about how to create a Launch Template targeting a Capacity Block, see Store instance launch parameters in Amazon EC2 launch templates.

The following steps explain how to launch instances into a Capacity Block in the active state using the AWS Management Console or the AWS CLI.

Console
To launch instances into a Capacity Block using the console
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation bar at the top of the screen, select the Region for your Capacity Block reservation.

  3. From the Amazon EC2 console dashboard, choose Launch instance.

  4. (Optional) Under Name and tags, you can name your instance and tag the instance. For information about tags, see Tag your Amazon EC2 resources

  5. Under Application and OS Images, select an Amazon Machine Image (AMI).

  6. Under Instance type, select the instance type that matches your Capacity Block reservation.

  7. Under Key pair (login), choose an existing key pair or choose Create new key pair to create a new one. For more information, see Amazon EC2 key pairs and Amazon EC2 instances.

  8. Under Network settings, use the default settings, or choose Edit to configure the network settings as necessary.

    Important

    Your instance can't launch in a subnet in a different Availability Zone from the Availability Zone where your Capacity Block is located.

    Your instance can't launch using an AMI with a different platform from the platform on your Capacity Block.

  9. Under Advanced details, configure the instance as follows.

    1. Under Purchasing option (market type), select Capacity Blocks.

    2. Under Capacity Reservation, select Target by ID.

    3. Select the Capacity Reservation ID of your Capacity Block reservation.

  10. On the Summary panel, for Number of instances, enter the number of instances to launch.

  11. Choose Launch instance.

AWS CLI
To launch instances into a Capacity Block using the AWS CLI
  • Use the run-instances command and specify a MarketType of capacity-block in the instance-market-options structure. You must also specify the capacity-reservation-specification parameter.

    The following example launches a single p5.48xlarge instance into an active Capacity Block that has matching attributes and available capacity.

    aws ec2 run-instances --image-id ami-abc12345 --count 1 \ --instance-type p5.48xlarge --key-name MyKeyPair \ --subnet-id subnet-1234567890abcdef1 \ --instance-market-options MarketType='capacity-block' --capacity-reservation-specification CapacityReservationTarget={CapacityReservationId=cr-a1234567}
    Important

    Your instance can't launch in a subnet in a different Availability Zone from the Availability Zone where your Capacity Block is located.

    Your instance can't launch using an AMI with a different platform from the platform on your Capacity Block.