Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launching AWS reserved Instances with Terraform

I want to create reserved instances for long periods of time like e.g. with one year run time. Does anybody know if Terraform allows to create such reserved instances in AWS?

I could now find anything in the Terraform documentation.

like image 623
kirrmann Avatar asked Feb 12 '18 16:02

kirrmann


People also ask

Can we start and stop EC2 instance using terraform?

The first step is to create an IAM policy that allows the following actions: Start an EC2 instance, Stop an EC2 instance, and list EC2 instances. This policy can be created with the below terraform resource definition.


1 Answers

Reserved instances in AWS work on a first come first served basis. If you create any on demand instance that happens to match the criteria of your reserved instance then it will use your reserved instance quota first.

The AWS docs also explain this:

Reserved Instances are automatically applied to running On-Demand Instances provided that the specifications match. If you have no running On-Demand Instances that match the specifications of your Reserved Instance, the Reserved Instance is unused until you launch an instance with the required specifications.

If you're launching an instance to take advantage of the billing benefit of a Reserved Instance, ensure that you specify the following information during launch:

  • Platform: You must choose an Amazon Machine Image (AMI) that matches the platform (product description) of your Reserved Instance. For example, if you specified Linux/UNIX, you can launch an instance from an Amazon Linux AMI.

  • Instance type: Specify the same instance type as your Reserved Instance; for example, t2.large.

  • Availability Zone: If you purchased a Reserved Instance for a specific Availability Zone, you must launch the instance into the same Availability Zone. If you purchased a regional Reserved Instance, you can launch your instance into any Availability Zone.

  • Tenancy: The tenancy of your instance must match the tenancy of the Reserved Instance; for example, dedicated or shared. For more information, see Dedicated Instances.

like image 83
ydaetskcoR Avatar answered Sep 20 '22 12:09

ydaetskcoR