This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import json | |
import boto3 | |
ip="1.1.1.1/32" | |
new_ip="2.2.2.2/32"' | |
for region in ["us-east-1","us-west-1", "us-west-2"]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
# Displays all the policies associated to IAM username | |
# Useful for reviewing IAM user rights | |
# Requirements: | |
# | |
# Environmental variables: | |
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY | |
# python: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import json | |
import boto3 | |
for region in ["us-east-1","us-west-1", "us-west-2"]: | |
ec2=boto3.client('ec2', region ) | |
sgs = ec2.describe_security_groups()["SecurityGroups"] | |
for sg in sgs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
aws route53 list-health-checks | jq -r '["ID","FQDN"], ["--","---"], (.[][] | [.Id, .HealthCheckConfig.FullyQualifiedDomainName]) | @tsv' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
InstanceName=$1 | |
#for region in `aws ec2 describe-regions --output text | cut -f3` #unoptimized list order, but dynamic | |
for region in us-east-1 us-east-2 us-west-1 us-west-2 eu-north-1 ap-south-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-2 ap-northeast-1 sa-east-1 ca-central-1 ap-southeast-1 ap-southeast-2 eu-central-1; | |
do | |
Id=$(aws ec2 describe-instances --region $region --filters Name=tag-value,Values=$InstanceName | jq -r .Reservations[].Instances[].InstanceId) | |
if [ "$Id" != "" ]; | |
then | |
echo $Id | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
InstanceId=$1 | |
#for region in `aws ec2 describe-regions --output text | cut -f3` #unoptimized list order | |
for region in us-east-1 us-east-2 us-west-1 us-west-2 eu-north-1 ap-south-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-2 ap-northeast-1 sa-east-1 ca-central-1 ap-southeast-1 ap-southeast-2 eu-central-1; | |
do | |
Name=$(aws ec2 describe-instances --region $region --instance-ids=$InstanceId | jq -r '.Reservations[].Instances[].Tags[] | select(.Key=="Name").Value') | |
if [ "$Name" != "" ]; | |
then | |
echo $Name | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import sys | |
import os | |
import json | |
import boto3 | |
from botocore.exceptions import ClientError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export DOMAIN=test.info | |
export PROFILE=default | |
aws --profile ${PROFILE} route53 list-resource-record-sets --hosted-zone-id $(aws --profile ${PROFILE} route53 list-hosted-zones-by-name --dns-name ${DOMAIN} --max-items 1 | jq -r .HostedZones[0].Id) > /tmp/${DOMAIN}.json | |
for a in $(cat /tmp/${DOMAIN}.json | jq -r '.[][] | "\(.Name),\(.ResourceRecords[0].Value)"' | sort | uniq); do | |
rr=$(echo $a | awk -F"," '{print $1}') | |
value=$(echo $a | awk -F"," '{print $2}') | |
echo -n "$rr,$value," |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import print_function | |
import boto3 | |
from pygments import highlight, lexers, formatters | |
from botocore.exceptions import ClientError | |
iam = boto3.resource('iam') | |
s3 = boto3.client('s3') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#based on: | |
#https://aws.amazon.com/blogs/database/a-serverless-solution-to-schedule-your-amazon-dynamodb-on-demand-backup/ | |
from __future__ import print_function | |
from datetime import date, datetime, timedelta | |
import json | |
import boto3 | |
import time | |
from botocore.exceptions import ClientError | |
import os |