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.
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.
Related
My AWS solution spans over 3 availability zones. In my backend the user is able to trigger a heavy compute job with beefy px instances. Therefore I wrote a CFN template, which provision all resorucess to execute the compute job (secret store, IAM Role, EC2 instance, log group). However when I try to create the template, it returns with a 500 and states that no capacity for my instance type is available for the availability zone i choose. My template provides a subnet for the EC2 instance and an availability zone for the attached volume. In the end I don't care in which availability zone the ec2 is provisioned as long it is in one of my subnets. Does someone know a way to provision an EC2 instance and it's volume (with cloudforamtion) by not specifically choosing one availability zone, but rather provide a range of subnets/availability zones ?
TLDR:
Does someone know a way to provision an EC2 instance and it's volume (with cloudforamtion) by not specifically choosing one availability zone, but rather provide a range of subnets/availability zones ?
So currently I have an application running on am m3.medium instance, its just an single instance running in EU/Ireland area.
If I go to EC2 and buy a reserved instance of m3.medium when will my Elastic beanstalk instance starting using it. Does it just happen or do I have to redeploy or do something else ?
Your EC2 instance will start billing at the discounted price immediately. It "just happens" like you said. Reserved instances are just a billing construct. They are just a discount on your monthly bill. You don't have to assign the reservation to a specific EC2 instance or anything like that.
Once you reserve an instance type, AWS checks for running instances in the region/availability zone where you purchased the reserved instances and applies the discount from the moment you purchased the reserved instances.
For example, you have five m3.medium instances running and you purchased three reserved m3.medium instances, AWS will apply discounted rates for three instances and on-demand rates for two instances.
A region has multiple AZs: Regions and Availability Zones. AWS used to offer RIs in AZs, now they made it flexible by offering it in regions and you can convert the RIs. See: Amazon EC2 Convertible Reserved Instances and the Reserved Instance Regional Benefit
Capacity reservation is the capacity or the instance reserved for you. If you choose AZ based reservation, then capacity is guaranteed. ie., if you reserved a m4.large, you are guaranteed to get a m4.large for the entire reservation period - even if you stop the instance. Always a m4.large instance is set aside for you.
By choosing the region based reservation - which is flexible than the more rigid AZ based reservation - your capacity is not guaranteed. ie., if you reserved a m4.large, you are not guaranteed to get a m4.large for the entire reservation period - in case you stop the instance and start it after sometime or launch a new m4.large instance, your request can be denied because AWS may not have m4.large instance to fulfill your request.
Reserved Instances are more of a billing construct. If you have Reserved Capacity in an Availability Zone, you just need to provision your instance in that Availability Zone. If your Reserved Instance is set to Region, you just need to provision your instance in that region. When it comes to billing, it basically credits you for each instance that matches a reservation.
Check out How Do RIs Work for more information
Once I purchased a reserved instance and i launched an instance with the same specification of the reserved instance. But in billing the launched instance is shown as on-demand instance.
May I know the steps to launch an EC2 instance from a reserved instance?
Please check if your specification really mach, the RI should be applied when parameters match
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/apply_ri.html
Recently I have purchased a reserved instance EC2 t2.medium.
There is no option to start and stop, whereas my freetire has all the features including stop, start, with public ip, etc.
Please Suggest me, how to use and work around reserved instance||
Reseverd instances are not started or stopped, they merely present the reservation of an on-demand instance at a reduced price. In order to use your reserved instance, you just need to have an instance of the same type as your reserved one already launched, or launch an on-demand instance of the same type and the reservation will be allocated to your instance. The only thing you need to make sure is that the servers will be started in the same availability zone as your reserved instance (for example - if your reserved instance is for us-east-1c AZ you have to choose the same AZ for your on-demand instance)
To make sure you are using the full amount of reserved instances at your disposal, you can check the reports section of your ec2 dashboard. the EC2 Reserved Instance Utilization reports will show you the amount of reserved instance being utilized.
As I understand in order to take advantage of reserved instance pricing, the AZ of the reserved instance must match the AZ of my Elastic Beanstalk's EC2 instance.
In order to achieve this I figure I would need to limit my EB app to just one availability zone. This would guarantee my main instance is running in the discounted AZ.
But by doing this additional instances would also be locked into this zone potentially reducing availability.
Are these assumptions correct? And if so how can I work around them so that my main instance is always in the discounted zone, and additional instances can be in another zone?
You assumptions are right.
Reserved instances are bound to the availability zone (though they recently started allowing the AZ modification before the tenure expiry - http://aws.amazon.com/about-aws/whats-new/2013/09/11/amazon-ec2-now-offers-reserved-instance-modifications/).
The only thing you can ensure is that out of the many AZ which you choose in beanstalk, keep them as much same as the Reserved instances. In AWS words "If you purchased Reserved Instances, you need to specify the same Availability Zone(s) that you specified when you purchased your Reserved Instances"
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.as.html
Are you could buy two RI and put them in two different AZ and limit your EB to those two AZ then at least you have some redundancy.