AWS EC2 Instances with Load Balancing during very high traffic - amazon-web-services

Our website is available throughout the year, and can handle traffic quite well with an AWS EC2 medium instance type. Every now and then (once a month), we get really heavy traffic though, and might need several extra large instances. We know when this will occur, and so we can start up instances in advance.
I have just noticed that we would save quite a bit of money when pre-purchasing a medium reserved instance, compared to our current on-demand instance. The problem is that such a reserved instance would mean that our master will be fixed at a medium instance type.
My question is this: Would there be any issues having such a small master, when we need to start-up new x-large slaves? What advantages would there be to keeping the master as an on-demand instance?

Reserved instances are there to save money for those instances you regularly run. I would suggest using reserved instances for your 'master'. The only advantage of keeping that one on-demand is the advantage that you could scale up or down as soon as your constant flow of traffic changes up or down. Make sure you choose the right use for your reserved instance; an 'always-on reserved instance' should have an heavy-use reserved purchase. Those 'peak instances' do best as an on-demand instance.

Just because you have a reservation does not mean you need to be running it all the time. The reservation will apply to any instance matching its parameters.
There are different reservation options as well depending how heavily you use a given instance type. You can take advantage of reserved instances and continue to do what you are doing, you don't need to switch anything.

Related

I want AWS Spot pricing for a long-running job. Is a spot request of one instance the best way to achieve this?

I have a multi-day analysis problem that I am running on a 72 cpu c5n EC2 instance. To get spot pricing, I made my code interruption-resilient and am launching a spot request of one instance. It works great, but this seems like overkill given that Spot can handle thousands of instances. Is this the correct way to solve my problem or am I using a sledgehammer to squash a fly?
I've tried normal EC2 launching, which works great, except that it is four times the price. I don't know of any other way to approach this except for these two ways. I thought about Fargate or containers or something, but I am running a 72 cpu c5n node, and those other options won't let me use that kind of horsepower (that I know of, hence my question).
Thanks!
Amazon EC2 Spot Instances are an excellent way to get cheaper compute (up to 90% discount). The only downside is that the instances might be stopped/terminated (your choice) if there is insufficient capacity.
Some strategies to improve your chance of obtaining spot instances:
Use instances across different Instance Types and Availability Zones because they each have different availability pools (EC2 Spot Fleet can assist with this)
Use resources on weekends and in evenings (even in different regions!) because these tend to be times of lower usage
Use Spot Instances with a specified duration (also known as Spot blocks), but this is at a higher price and a maximum duration of 6 hours
If your software permits it, you could split your load between multiple instances to get the job done faster and to be more resilient against any stoppages of your Spot instances.
Hopefully your application is taking advantage of all the CPUs, otherwise you'd be better-off with smaller instances.

AWS:What will be more price efficient Instance or Reserved Instance for EC2

I have a regular AWS EC2 m3.large instance that I use for a few days a month, when I'm not using it I stop it, and just start it when I need it. I have the understanding that I only pay for it when it is actually running, is that correct ?
I've just recently noticed reserved instances, I'm happy to commit to a term of a few years, however I don't need to use it every day. So assuming my first assumption is correct does that also apply to reserved instances or do i have to pay every day whether or not Im using.
If is a good idea can I convert my existing instance to a reserved instance or do I have to setup a new machine from scratch ?
You have to pay for reserved instance even if you are not using it. The capacity is already reserved for it and you may have already paid a partial payment upfront for you or you can choose no upfront. Reserved instance is use it or lose it.
You can use a calculator and see if reserved instance can save you $$.
You can convert your on-demand to reserved instance just by reserving an instance of same type in the same availability zone. AWS has made the instance reservation more flexible recently but if you are running a single instance, just reserve an instance of same type in the same availability zone. You can choose partial/no upfront, one or three year terms.
In us-east-1, on-demand cost for m4.large is $0.10/hour.
Monthly on-demand cost is: $72/month
Approximate reserved instance (one year) cost with no upfront: $50/month
Number of on-demand hours for $50: 500 hours (20 days)
If you plan to run for less than 500 hours/month, then you should go for on-demand. Remember, with reserved instances you are guaranteed an instance by AWS. Sometimes, on-demand may run out of capacity and you have to choose a different instance type. It is very rare but happens sometimes.
If you "reserve" an instance you have to pay for it.
m3.large instances that you stop you do not have to pay for, but keep in mind you might have to pay for other things like the EBS volume attached.
Judging by what you've said, its sounds like it's cheaper to start/stop the instance when you need it.

Is it possible that I request an EC2 instance but can't get fulfilled?

Edit: This question is NOT to ask about "Spot Instances"; this question is to ask regular "On Demand Instance". I think I need to clarify this, after reading comments below.
Basically, my question is about whether I should consider the risk that when I need to launch an EC2 instance, but that EC2 region has run out of capacity and can't fulfill my request.
I understand the chance for the above situation is extremely low, but I'd like to understand if AWS has any SLA to make sure that situation/risk won't happen.
There are protective controls in place to make the unavailability of a particular type of instance in a particular availability zone at a particular time unlikely... but it's possible, and there is no assurance provided by AWS that a given type of EC2 instance will be available for launch, on-demand, at any particular time, in any particular Availability Zone unless you purchased reserved instances of that type, specifically in that availability zone. In that case, there is supposed to always be sufficient hardware available so that you can have the number of paid reserved instances running, at minimum, including the ability to launch enough new instances to bring the total up to that minimum.
Reserved instances are commonly discussed in the context of their associated discount, but they have two purposes:
Reserved Instances are not physical instances, but rather a billing discount applied to the use of On-Demand Instances in your account. These On-Demand Instances must match certain attributes in order to benefit from the billing discount.
When you purchase Reserved Instances in a specific Availability Zone, they provide a capacity reservation. (emphasis added)
For example, if you purchased 4 reserved t2.2xlarge instances in us-east-2a, the assurance is that you will always be able to launch enough to bring the total running instances of that type in that zone to 4. If you already have 4, there's not an assurance of being able to start more, but there is an assurance that if you stop them, you will be able to start them again.
Pricing models for reserved instances has changed over the years, such that reserved instances are generally billed at the same rate whether they're running or not, so you can look at it one of two ways:
If you need the capacity all the time, you're getting a substantial discount... or, if you don't need the capacity all the time, you're technically paying all the time for capacity that is largely unneeded, but you are still paying less than you'd pay for on-demand instances without reservations, and you can either leave it running or launch it when you need it.
Should you consider the risk that an entire region has widespread capacity issues? You should consider it, but there are, historically speaking, other significant outage scenarios that are more likely... EBS and S3 have both had failures that impaired the ability to launch instances, even though the capacity was idle in EC2.
Yes. I've had API calls to create EC2 resources fail many times due to lack of available AWS resources. I most commonly see this when attempting to create a new EC2 instance with Dedicated Tenancy in a specific Availability Zone.
Yes. It is possible your instance request cannot be fulfilled. On-Demand instance does not guarantee you an instance. In particular,t2.small instances are more likely to be not fulfilled based on my experience. It is possible, AWS has only limited number of t2.small instances.
How can you make sure it is always fulfilled?
Reserve the instances for you so that it is not given to anyone else. But there is a cost associated with it. You have pay for the instance irrespective of whether you use it not. I am talking in general terms. Reserved instance is a complex topic, but that is the route you should take if you want AWS to guarantee you an instance.
The answer is yes, your launch request can fail because there is no available capacity in the relevant Availability Zone. I would say that it's a rare occurrence, but certainly possible.
You can mitigate by using multiple zones in the same region, other regions, or by using Reserved Instances.
Today it happened in an AWS account that I manage. If I am not wrong it was the family r4, exactly an r4.xlarge instance (4 hours ago) in Virgina Region. I had to choose a different AZ. That is why AWS always recommends working with more than one AZ.
But for that reason, I started to use Scheduled Reserved Instances
You always will have for a period of time a reserved capacity of a family type of instance(s).
Sure, it works if you have a defined schedule or workflow.
Hope it helps you.

AWS EC2 Transitioning From Pay As You Go to Reserved Instance

I have a micro instance of EC2 that I am currently paying for using pay-as-you-go. I am thinking about transferring this instance to a reserved instance (upfront fee + lower hourly charge). I read through the documentation here, but am still unclear about a couple of things.
First, will I be able to seamlessley 'transfer' my current pay-as-you-go instance onto the reserved instance platform without having to move my snapshot onto a new server? Also, does the 'Reserved Instance Type' only refer to the down payment + hourly rate options you have and not have anything to do with the actual performance of the box? From what I've read, I should choose the 'Heavy Utilization' option since the box will be running a site that is up 24/7.
You do not have to move your server or make any change when buying a reserved instance. You simply need to select an RI that is the same size and in the same region and availability zone as your current system. Heavy utilization is the best choice for you if your system runs 24/7. If you don't think you'll need it for a full year, consider buying from the marketplace where you may be able to buy in some increment lower than 1 year.
Reserved instances are just a billing feature. All you need to do is create a reservation that matches the parameters of your current instance.
It breaks down like this:
You just purchase an RI, and if it happens to match a running instance (same Region, Zone and Instance Type), you get a discount when running the instance.
Multiple RIs will match multiple instances.
If you're not running a "matching" instance, you don't get a discount.
The RI type (Heavy/Medium/Light) is just a trade-off on up-front cost vs discount cost. If you're running 24x7, get the heavy, it will save you the most money. If you don't want to invest a lot now, you can get the light and pay a little more, but loose less if you stop your instance.

How do I migrate an existing on-demand instance to spot instance?

My on-demand instance currently hosts a website, does a few computing, and serves as a light-load php server. To reduce the cost, I'm thinking about migrating it to a spot instance. I haven't found any clue on the web yet. Any pointers are greatly appreciated.
Spot instances and on-demand instances are two separate systems. While on-demand systems are available all of the time, you set a maximum bid for spot instances instead. If there are systems available for that price, they will be launched. However if there is a higher demand in your availability zone, these systems may be terminated without notice. So for hosting a website on AWS, I would not recommend using spot instances. If you want to reduce the price, you can have a look at reserved instances instead.
That said, you would probably have to stop your on-demand machine and set up a spot instance request for this machine instead.