Instantly share code, notes, and snippets.

View aurora_instance_resize
check_for='"PendingModifiedValues": {},'
aws rds modify-db-instance --db-instance-identifier "${primary_node}" --db-instance-class "${instance_size}" --apply-immediately --region "${region}"
View aws_query_group.php
require 'aws.phar';
// Readme:
// To populate hostnames based on current live values, look up from AWS directly.
// Requires:
// - aws.phar in same folder as this script, or full path specified in the above require
// - IAM role assigned to node that allows Get* for ec2
View aws_query_group
aws ec2 describe-instances --region us-east-1 --filters "Name=tag:Group,Values=fancyapp1" --output json --query 'Reservations[*].Instances[*].{Name:Tags[?Key==`Name`].Value,PublicIP:PublicIpAddress}'
View query_ec2_older_than
# Example how to query AWS for nodes that have been online older than a certain date
# Example below returns just the "Name" tag value (intent is for looping through for other actions)
# Example below also filters by "state=running" to excluded stopped or pending instances
# To get newer than a certain date, just alter ?LaunchTime<=${ec2_older_than_date} for the <= to be >=
View update_asg
from __future__ import print_function
import json
import datetime
import time
import boto3
print('Loading function')