Jim Lynch Codes
  • Blog
  • About Jim

Writings about one coder's stories & experiences.

Understanding AWS Costs For Ec2 Linux Servers

10/7/2019

0 Comments

 
Good old AWS, the mercedes benz of cloud server hosts. I was at AWS today, and I got a better understanding of how to best run Ec2 servers to save in costs. ;)

The Billing Page(s)

If you log into the AWS console and, in the upper right corner, click on your name and then "My Billing Dashboard". You will then be taken to a page that shows you the estimated costs of what you should expect to pay so far for this month. 
Picture
Personally though, I prefer to look at the bill for the previous month(s) to see where there were high expenses. One you are only the billing dashboard, look on the left for a link that says "Bills". This will take you to a page with a more detailed breakdown of exactly what AWS services correspond to what charges. 
Picture

Ec2 - It's All About The Hours

A key thing to note about Ec2 linux servers is that you do not get charged for starting and stopping- you are charged per hour that each sized server is running. That means that you should be charged the same whether you have 5 micro instances running for 100 hours a month each or one instance running for 500 hours a month.

Have A Start & Stop Lambda Function

A good way to save costs is to stop your Ec2 servers whenever you don't need to have them running. Better yet, more everything to AWS Lambda (but I get it, some things need to be continuous processes running all the time so sadly you can't easily move them to serverless. :( 
The next best thing to serverless is having your Ec2 servers automatically start and stop. This can be done relatively easily by writing some code using the 'ec2' library in javascript, python, java, etc. that calls the "startServer" and "stopServer" functions. This way you are only paying for the hours you need the servers to be running and not wasting costs and times when nothing is even hitting it (such as in the wee hours of the night, weekends, etc.

Cost Allocation Tags

The Bills page is really nice because it breaks down your costs by each AWS service, but what if you want things broken down even finer than that? Suppose you have one AWS account but many engineers on multiple teams and you want to know how much of the Ec2 costs are attributed to one teams servers and how much is attributed to the other team's servers? Welp, our friends at AWS thought you might want that feature so they created it and called it "allocation tags". This lets you tag things to be broken down cost-wise so that you can look at the different tag groups and compare them to each other.
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    ​Author

    Picture
    The posts on this site are written and maintained by Jim Lynch. About Jim...
    Follow @JimLynchCodes
    Follow @JimLynchCodes

    Want FREE access to
    my daily stock tips 
    ​newsletter called,
    "The Triple Gainers"?

    Sign up here!

    Categories

    All
    Actionscript 3
    Angular
    AngularJS
    Automated Testing
    AWS Lambda
    Behavior Driven Development
    Blogging
    Business Building
    C#
    C / C++
    ClojureScript / Clojure
    Coding
    Community Service
    CS Philosophy
    Css / Scss
    Dev Ops
    Firebase
    Fitness
    Flash
    Front End
    Functional Programming
    Git
    Go Lang
    Haskell
    Illustrations
    Java
    Javascript
    Lean
    Life
    Linux
    Logic Pro
    Music
    Node.js
    Planning
    Productivity
    Professionalism
    Python
    React
    Redux / Ngrx
    Refactoring
    Reusable Components
    Rust
    Security
    Serverless
    Shell Scripting
    Swift
    Test Driven Development
    Things
    TypeScript
    Useful Sites
    Useful Tools
    Video
    Website Development
    WebStorm
    Writing

    Archives

    October 2020
    September 2020
    May 2020
    April 2020
    February 2020
    January 2020
    December 2019
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015

    RSS Feed

  • Blog
  • About Jim
JimLynchCodes © 2021