Resource: aws_ec2_capacity_reservation

Provides an EC2 Capacity Reservation. This allows you to reserve capacity for your Amazon EC2 instances in a specific Availability Zone for any duration.

Example Usage

resource "aws_ec2_capacity_reservation" "default" {
  instance_type     = "t2.micro"
  instance_platform = "Linux/UNIX"
  availability_zone = "eu-west-1a"
  instance_count    = 1
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import Capacity Reservations using the id. For example:

import {
  to = aws_ec2_capacity_reservation.web
  id = "cr-0123456789abcdef0"
}

Using terraform import, import Capacity Reservations using the id. For example:

% terraform import aws_ec2_capacity_reservation.web cr-0123456789abcdef0