< Home

As I am a firm believer of cost optimizations in the Cloud, one thing that struck me as quite odd is that many fellow engineers really don’t care about the cost. They spin up too big (and expensive) servers. They never check if other servers are more appropriate (even when CPU/Memory usage doesn’t even go past 5% a whole month). When they test something they don’t terminate after testing. They just use a lot of cloud resources without thinking about the costs.

I’ve even seen simple Worker scripts being deployed on solo instances. These were script that would maybe be called once or twice every hour and run for 5 seconds. Perfect examples of Lambda-type workloads that all received their own 24/7 spinning instance.

And no, I don’t want to limit them in any way.

I don’t want to write IAM restrictions or very strict budget alerts. I want them to experiment with different types of services, I want them to try out new architectures and see if it is a better fit for us. Sometimes it can even cost more than the current situation if the quality improves.

But what I do want is that they get a feeling of the cost of the environment. And that is why I created a CDK construct named “Daily Spend to Slack”. It utilizes the native AWS Chatbot with a technique to “spoof manual messages

This is a very simple script that fetches the yesterday daily spend through the Cost and Explorer API and post it in a channel of choosing.

Making your DevOps engineers aware of what the yesterday’s changes incurred and applying the “Prius Effect”. This can greatly improve your co-engineers cost awareness of their actions and decrease (or optimize) the total cost of your environments.

Prius Effect

The  Prius Effect is a phenomenon coined when the hybrid Toyota Prius introduced real time feedback on gasoline consumption.  
It was observed and documented that a large subset of drivers would respond to the data by driving in a manner that decreased fuel consumption.  
This real time feedback is now a staple on many cars, including some powered by a gasoline engine only.

https://powerhousedynamics.com/resources/white-papers/prius-effect1/

You can find the AWS CDK construct on the constructs.dev website

Not running AWS CDK

Not to worry, this construct does the following

  1. Create a CloudWatch cronjob that will call a Lambda function once a day
  2. This Lambda function (/functions/run.py) will call the Cost Explorer API with a date range from yesterday until today and post it to an SNS
  3. This SNS is configured to fan out to AWS Chatbot but e-mails are also possible (TODO for my construct 😅)
  4. AWS Chatbot will post it to Slack
< Home