[HN Gopher] Show HN: Tiny CLI to save AWS costs in dev environme... ___________________________________________________________________ Show HN: Tiny CLI to save AWS costs in dev environments when you're sleeping Author : aramalipoor Score : 72 points Date : 2020-08-22 16:25 UTC (6 hours ago) (HTM) web link (www.npmjs.com) (TXT) w3m dump (www.npmjs.com) | stekern wrote: | If you're using IaC and have it set up in a CI/CD pipeline, you | could also achieve the same by having a cronjob set a flag | outside of work hours, and use conditionals in your IaC based on | the value of that flag (e.g., for Terraform `count = | var.scale_down ? 0 : 1`) | barkingcat wrote: | I find it price gouging that AWS doesn't already implement this | on their own within their pricing structure and that you need a | 3rd party tooling to do this. | aynsof wrote: | AWS Instance Scheduler is an official AWS Solution: | https://aws.amazon.com/solutions/implementations/instance-sc... | | It allows you to create automatic start and stop schedules for | your Amazon EC2 and Amazon RDS instances. It uses a combination | of CloudWatch/Lambda/DynamoDB to check against tagged | instances. | bufferoverflow wrote: | If you don't like their prices, why don't you just switch to | another provider? Plenty of good clouds. And even more | dedicated / VPS servers, if you want truly crazy savings. | aliswe wrote: | Are you seriously alleging that NOT implementing a "stop | resources when I sleep/am not around" feature amounts to price | gouging? | cybrix wrote: | They earn more money by not doing this. | spockz wrote: | The downside of shutting down the resources is that there may | be none available anymore in that sizing or pricing when you | want to start them up again. I suppose they also don't want | to risk being liable for that. | pc86 wrote: | That's not what price gouging is. | weeefun wrote: | It looks like a nice tool doing it's job well :-) I'd also | consider services like provisioned DynamoDB tables or Kinesis | streams in this context because there you can also waste lots of | money depending on your setup. For example, you could decrease | the provisioned read/write capacity for a DynamoDB table or | decrease the shards of a Kinesis stream over night. I've | discussed these topics in a blog post, in the context of a | CloudFormation stack, if anyone's interested: | https://www.sebastianhesse.de/2018/04/22/shut-down-cloudform... | aramalipoor wrote: | Thanks for sharing your experience. Both of them sounds like | great ideas, will add them to ToDo right away :) | aramalipoor wrote: | Just published a tiny CLI utility to save some bucks on AWS | development environment while I'm not really working. | | https://github.com/aramalipoor/aws-cost-saver | | The idea is to stop/shutdown any resources (such as EC2 | instances, RDS databases, ECS tasks, etc.) when you're done for | the day and restore them back up next time you continue. | | Currently it's in a very early stage, a hobby side-project :) | | Ideally I'm thinking to provide a CloudFormation template or | terraform config for example, to provision a scheduled Lambda | with predefined "start of work" and "end of work" times and have | it automatically do that for you. | | I'd like to know if something like this would be useful for you | too and what do you think about it? | adamlklein wrote: | This sounds like a good idea! | | I had been looking at creating a lamba to check for the | existence of pods, services, alternate namespaces etc., as I | learn K8s on AWS, to shut down the cluster when I'm not working | on it. | aramalipoor wrote: | Thanks. Shutting down K8S cluster when not using is a really | good idea. Maybe one day I play around with AWS's k8s cluster | and add the trick to aws-cost-saver. | | Pull requests are also welcome if you have time :) the logic | must be similar to EC2 or RDS tricks: | https://github.com/aramalipoor/aws-cost- | saver/blob/master/sr... | swyx wrote: | interesting work! i feel like this can't be a new problem. what | comparable tools exist for doing this today? its basically just | spinning up a staging env while you work and spinning down when | you knock off work right? almost like a heroku dyno spinning up | for you. | aliswe wrote: | I would regard it as a fairly new problem actually, the same | age as the "developer resources on a per-minute basis" | phenomenon. | z3t4 wrote: | Im very interested in learning about your work flows, like how | does a typical day look like? I do all my work on a local pc | and only use servers for production. So im interesting in | how/why you use the cloud stack | jen20 wrote: | How do you test or develop against cloud resources like ECS | using a local PC? | krono wrote: | Ok, I don't know how else to ask and I'm seriously not | trying to be an arse but how do you? I'm genuinely | interested as it's something I've been struggling with | myself lately. | ununoctium87 wrote: | https://github.com/localstack/localstack | | Though I find a stronger argument in using containerisation | to ensure an identical application run-time environment no | matter the infra it's running on. | | If we are talking about infra engineering, then sure. | That's where I find localstack helps | WrtCdEvrydy wrote: | This is amazing.... | | Edit: I wonder if you could put this inside of a lambda with | just a role. | redacted3212 wrote: | CloudCustodian has offered this for quite some time. We use | it at our company in all our accounts. | aramalipoor wrote: | Thanks. Agree with you, having it in a Lambda with a | scheduled trigger or even manual trigger will be really | useful. | banana_giraffe wrote: | Or an API gateway. I have something similar (though very | bespoke for me) that has a simple API Gateway web page as | it's front-end. It also opens up a firewall entry for my IP | so I can connect to the machine. | | Depending on my mood I either use the web page or some | simple curl aliases to start and stop an instance. | fareesh wrote: | Is it common to have a dev environment on AWS? I just use it for | production and maybe staging. Staging is scheduled to run during | office hours. | vitalysh wrote: | I guess depends on the size of the company. How else would you | constantly test integrations between different services? | Especially if some services can't be easily ran on the laptop. | | Also if you add terraform/ansible and all that jazz to the | table. Where else? Infra team needs dev/stage as well. | wuunderbar wrote: | Localstack can get you pretty far. | carnitas wrote: | My company tasked me to mad dash their dev environment to AWS. | Why? Because "cloud", and perceived less risky than moving QA | and Prod first. | dabeeeenster wrote: | This is awesome - Does it work cross-region? | | +1 to add in: | | - Elasticache instances - Load balancers associated with ECS | clusters | gvenkat wrote: | aws has a instance scheduler as a solution that achieves some of | this objectives | | https://aws.amazon.com/solutions/implementations/instance-sc... | 60secz wrote: | Because my favorite place for AWS credentials is some random NPM | module? | debaserab2 wrote: | This works like every other AWS CLI tool - it uses your shells | AWS credentials dir or ENV vars | chromedev wrote: | That is what Kind is for. ___________________________________________________________________ (page generated 2020-08-22 23:01 UTC)