AWS Amazon EC2 Capacity Reservation

This page shows how to write Terraform and CloudFormation for Amazon EC2 Capacity Reservation and write them securely.

aws_ec2_capacity_reservation (Terraform)

The Capacity Reservation in Amazon EC2 can be configured in Terraform with the resource name aws_ec2_capacity_reservation. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

github-iconniveklabs/aws
resource "aws_ec2_capacity_reservation" "this" {
  availability_zone       = var.availability_zone
  ebs_optimized           = var.ebs_optimized
  end_date                = var.end_date
  end_date_type           = var.end_date_type
  ephemeral_storage       = var.ephemeral_storage
github-iconmike23101994/terraform-scripts
resource "aws_ec2_capacity_reservation" "nile-capacity-reservation" {
  instance_type     = var.instance_type
  instance_platform = var.instance_platform
  availability_zone = var.placement_availability_zone
  instance_count    = var.instance_count
}
github-iconmike23101994/terraform-scripts
resource "aws_ec2_capacity_reservation" "nile-capacity-reservation" {
  instance_type     = var.instance_type
  instance_platform = var.instance_platform
  availability_zone = var.placement_availability_zone
  instance_count    = var.instance_count
}
github-iconblinkops/blink-aws-query
resource "aws_ec2_capacity_reservation" "named_test_resource" {
  instance_type     = "t2.micro"
  instance_platform = "Linux/UNIX"
  availability_zone = "us-east-1a"
  instance_count    = 1
}

Parameters

Explanation in Terraform Registry

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

AWS::EC2::CapacityReservation (CloudFormation)

The CapacityReservation in EC2 can be configured in CloudFormation with the resource name AWS::EC2::CapacityReservation. The following sections describe how to use the resource and its parameters.

Parameters

Explanation in CloudFormation Registry

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

Frequently asked questions

What is AWS Amazon EC2 Capacity Reservation?

AWS Amazon EC2 Capacity Reservation is a resource for Amazon EC2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon EC2 Capacity Reservation?

For Terraform, the niveklabs/aws, mike23101994/terraform-scripts and mike23101994/terraform-scripts source code examples are useful. See the Terraform Example section for further details.