Skip to content

Instantly share code, notes, and snippets.

View gandrapukarthik's full-sized avatar

gandrapukarthik

View GitHub Profile
@gandrapukarthik
gandrapukarthik / toggleAutoScalingGroup.md
Created February 7, 2024 09:21 — forked from FANMixco/toggleAutoScalingGroup.md
AWS Auto Scaling Groups: scheduled start/stop

Many times, we have a lot of cloud waste because we never shut down our services/EC2 instances. One of the trickiest cases to control is the Auto Scaling Groups.

Now, this tutorial that is based on Vicent's one, I'm going to help you automate this task using AWS EventBridge and Lambda functions.

It's important to highlight that you must create two Lambda functions:

  1. One for stopping that is going to have a 0 as the environment variables (MAX_SIZE and DESIRED_CAPACITY).
  2. One for starting that is going to have 1+ as the environment variables (MAX_SIZE and DESIRED_CAPACITY).

Now, the steps:

@gandrapukarthik
gandrapukarthik / toggleAutoScalingGroup.md
Created February 7, 2024 09:21 — forked from FANMixco/toggleAutoScalingGroup.md
AWS Auto Scaling Groups: scheduled start/stop

Many times, we have a lot of cloud waste because we never shut down our services/EC2 instances. One of the trickiest cases to control is the Auto Scaling Groups.

Now, this tutorial that is based on Vicent's one, I'm going to help you automate this task using AWS EventBridge and Lambda functions.

It's important to highlight that you must create two Lambda functions:

  1. One for stopping that is going to have a 0 as the environment variables (MAX_SIZE and DESIRED_CAPACITY).
  2. One for starting that is going to have 1+ as the environment variables (MAX_SIZE and DESIRED_CAPACITY).

Now, the steps:

@gandrapukarthik
gandrapukarthik / lambdaAMICleanup.py
Created April 25, 2019 04:22 — forked from bkozora/lambdaAMICleanup.py
AWS Lambda Function to Delete AMIs and Snapshots
# Automated AMI and Snapshot Deletion
#
# @author Robert Kozora <[email protected]>
#
# This script will search for all instances having a tag with "Backup" or "backup"
# on it. As soon as we have the instances list, we loop through each instance
# and reference the AMIs of that instance. We check that the latest daily backup
# succeeded then we store every image that's reached its DeleteOn tag's date for
# deletion. We then loop through the AMIs, deregister them and remove all the
# snapshots associated with that AMI.
@gandrapukarthik
gandrapukarthik / lambdaAMIBackups.py
Created January 31, 2019 06:20 — forked from bkozora/lambdaAMIBackups.py
AWS Lambda AMI Backups
# Automated AMI Backups
#
# @author Robert Kozora <[email protected]>
#
# This script will search for all instances having a tag with "Backup" or "backup"
# on it. As soon as we have the instances list, we loop through each instance
# and create an AMI of it. Also, it will look for a "Retention" tag key which
# will be used as a retention policy number in days. If there is no tag with
# that name, it will use a 7 days default value for each AMI.
#
@gandrapukarthik
gandrapukarthik / redis.markdown
Created January 2, 2019 11:05 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@gandrapukarthik
gandrapukarthik / ruby.2.5.1-setup.sh
Created December 28, 2018 04:55 — forked from mustafaturan/ruby.2.6.3-setup.sh
ruby 2.5.1 setup for centos 6.x
#!/usr/bin/env bash
# repository
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
# system update
yum -y update
yum -y groupinstall "Development Tools"
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick