Tag Archives: cloud computing

AVAILABILITY ON THE SPOT: THE USE OF AWS SPOT INSTANCES TO ACHIEVE COST EFFECTIVE AVAILABILITY

Presenters

  • Lisa Smith, Infrastructure Engineer, CSUN
  • Steven Fitzgerald, Professor & Director of META+LAB, CSUN
  • Jorge Ruiz, Infrastructure Engineer, CSUN

META-LAB experience: provide real-world experience to CSUN students

New project = new problem

  • Create a new environment that is highly available and highly scalable for the lowest cost possible
  • When hosting a new app an IT team needs to determine the best solution for hosting the app
  • We considered: upfront cost, scalability, end-user satisfaction

Cloud Computing

Practice of using a network of remote servicers hosted on the internet to store, manage, and process data, rather than a local server

On-demand delivery of IT resources

Deployment Models

  • On-premise: physical in-house infrastructure
  • Al-in-cloud all virtualized cloud infra
  • Hybrid: on-premise and all-in-cloud

Pricing Models

  • On-demand: pay-as-you-go
  • Reserved: pay in advance and save the most (nothing up-front, partial up-front, all up-front)
  • Spot: savings up to 90%, dedicated (VERY CHEAP)

To Amazon, spot instances are unused “spare machines” nobody is using, and therefore wasting money from Amazon’s perspective.

AWS Terminology and Services

  • Region is a geographical area
  • Each region is made of 2 or more availability zones (achieves fault tolerance and stability, regions are isolated from one another)
  • You enable and control data replication across regions: when you distribute apps across multiple AZs, be aware of location-dependent privacy and compliance requirements.
  • EZ AZ is made up of 1 or more data centers
  • VPC: Networking component; same functionalities of an on-premise network (subnets, route tables, NAC lists, etc.)
  • EC2 and ELB: virtual servers and elastic load balancing (distribute incoming traffic, adjust to rapid changes in network traffic by distributing across multiple EC2 instances in the cloud w/out manual intervention.
  • Lambda: fully managed serverless compute, zero-admin compute platform, lets you run code w/out provisioning or managing servers, pay only for the compute time you consume.
  • Amazon Databases: RDS (MySQL, MSSQL Server, Postgresql, MariaDB, Oracle. High durability and highly available (multiple deployment types).

Availability on the Spot

  • https://calstatepays.org
  • How do we use cloud services to improve our infra and decrease costs for the client?
  • Make sure the infra was highly available and fault tolerant

Challenges of Spot Instances

  • Spot price fluctuates
  • Hourly prices is based on demand
  • 2 minute interruption warning(!)
  • Typically used if you can afford interruptions

Forming Solutions

For calstatepays.org: EC2 Spot Instances, Cloudwatch (triggering a Lambda function if the alarm is triggered), ELB to control traffic. An infrastructure diagram was shared.

Cloudwatch constantly watches our instances, when someone is willing to pay more for our spot instances, it tells us about the 2-minute warning so we can be proactive and do something about it. We call a Lambda function which spins up an additional spot instance for us, and it is configured so that it is registered with and works with our ELB. We use AMIs (pre-built images) that are configured for our application.

Final Thoughts

This solution allowed us to build an inexpensive and fault-tolerant infrastructure for CalStatePays.org.

Q: how often have spot instances gone done for you? I don’t think we’ve changed our spot instance price for three months.

Q: Is there the possibility that both instances could go down? Yes, that can happen but it’s very rare. The 2-minute window is enough notice in our experience. We have an 18-month history of costs, and over 6 months it didn’t actually go up at all.

Q: can you do this for RDS as well? Yes.

Q: where are user sessions stored? Our application was an SPA (single page application); we never wrote to the local disk, it was always retrieved from the RDS instance. Load balancer will help to handle this.

Q: in Lambda, does your rule account for cost increases? YES! It queries current prices and selects the lowest cost one based on a bidding rule that we set, i.e. the least amount of money.

Q: you have used spot instances exclusively for this app, or is anything in “on-demand” instances? Only our RDS is on an on-demand instance. And we monitor that with a separate Lambda function. You’ve found that there’s always a spot instance available? Yes. In our experience, it’s worked well. Prices are pretty steady, but you can monitor that.

Q: how long have you been running the app in this scenario: Feb/Mar.