使用 Terraform 启动 AWS 预留实例

Launching AWS reserved Instances with Terraform

我想创建长时间的预留实例,例如用一年 运行 的时间。有人知道 Terraform 是否允许在 AWS 中创建此类预留实例吗?

我现在可以在 Terraform 文档中找到任何内容。

AWS 中的预留实例先到先得。如果您创建的任何按需实例恰好符合您的预留实例的条件,那么它将首先使用您的预留实例配额。

AWS docs也说明一下:

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.