I hereby claim:
- I am garnaat on github.
- I am garnaat (https://keybase.io/garnaat) on keybase.
- I have a public key whose fingerprint is A6C2 33BA 6313 1605 6E70 1EE4 F2E1 4005 8CC6 80A4
To claim this, I am signing this object:
import boto | |
# Create a connection to the Identity & Access Management Service | |
iam = boto.connect_iam() | |
# Create a new user | |
user_data = iam.create_user('pycon') | |
# Create a new group | |
group_data = iam.create_group('pythonistas') |
{ | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": ["s3:ListBucket"], | |
"Resource": ["arn:aws:s3:::pyconprod"] | |
}, | |
{ | |
"Effect": "Allow", | |
"Action": ["s3:GetObject"], |
{ | |
"Statement": [ | |
{ | |
"Sid": "Stmt1363151440055", | |
"Action": [ | |
"iam:ListInstanceProfiles", | |
"iam:ListRoles", | |
"iam:PassRole" | |
], | |
"Effect": "Allow", |
import botocore.session | |
session = botocore.session.get_session() | |
ec2 = session.get_service('ec2') | |
operation = ec2.get_operation('DescribeInstances') | |
endpoint = ec2.get_endpoint('us-west-2') | |
# Calling with no parameters will return all instances | |
# associated with this account in this region. | |
http_response, data = operation.call(endpoint) | |
# You could also limit the results to only certain |
import boto.ec2 | |
ec2con = ec2.connect_to_region("us-west-1") | |
snap = ec2con.get_all_snapshots(['snap-3b82a650'])[0] | |
print(snap.id) | |
print(snap.volume_id) | |
print(snap.status) | |
print(snap.start_time) | |
print(snap.owner_id) | |
print(snap.volume_size) |
aws ec2 describe-instances --filters Name=tag-key,Values=component --query 'Reservations[].Instances[].Tags' |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env python | |
""" | |
Launch an AWS Web Console. | |
Usage: | |
awsconsole launch --role=<role_arn> [--profile=<profile_name>] | |
Commands: | |
launch - Launch the AWS Console in your default web browser with | |
the specified credentials. The console will be authenticated |
#!/usr/bin/env python | |
import requests | |
import time | |
import json | |
import click | |
@click.command() | |
@click.option('--name', prompt='metric name', | |
help='the name of the custom metric', required=True) |
import skew | |
# Add whitelisted CIDR blocks here, e.g. 192.168.1.1/32. | |
# Any addresses not in this list will be flagged. | |
whitelist = [] | |
for secgrp in skew.scan('arn:aws:ec2:*:*:security-group/*'): | |
for ipperms in secgrp.data['IpPermissions']: | |
for ip in ipperms['IpRanges']: | |
if ip['CidrIp'] not in whitelist: |