This file contains hidden or 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
import json | |
import os | |
import boto3 | |
import botocore | |
import logging | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
s3 = boto3.client('s3') |
This file contains hidden or 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
import boto3 | |
from prettytable import PrettyTable | |
res = PrettyTable() | |
res.field_names = ["Database", "Table", "Partition Num"] | |
glue = boto3.client('glue') | |
dbs = glue.get_databases()['DatabaseList'] |
This file contains hidden or 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 | |
token=`aws sts get-session-token --serial-number $1 --token-code $2 --profile $3` | |
ak=`echo $token | jq '.Credentials.AccessKeyId' | tr -d '"'` | |
sk=`echo $token | jq '.Credentials.SecretAccessKey' | tr -d '"'` | |
st=`echo $token | jq '.Credentials.SessionToken' | tr -d '"'` | |
aws configure set aws_access_key_id $ak --profile mfa | |
aws configure set aws_secret_access_key $sk --profile mfa |
This file contains hidden or 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
import boto3 | |
ec2 = boto3.client('ec2') | |
regions_res = ec2.describe_regions() | |
regions = [region['RegionName'] for region in regions_res['Regions']] | |
for region in regions: | |
region_list = [region] | |
ec2 = boto3.client('ec2', region_name=region) |