Skip to content

Instantly share code, notes, and snippets.

from __future__ import print_function
import boto3
#from datetime import datetime, timedelta, tzinfo
def sts_info(event, context):
sts = boto3.client('sts')
caller_id = sts.get_caller_identity()
awsid = caller_id['Account']
http_header = caller_id['ResponseMetadata']['HTTPHeaders']
from __future__ import print_function
import boto3
def sts_info(event, context):
sts = boto3.client('sts')
caller_id = sts.get_caller_identity()
awsid = caller_id['Account']
http_header = caller_id['ResponseMetadata']['HTTPHeaders']
date = caller_id['ResponseMetadata']['HTTPHeaders']['date']
response_metadata = caller_id['ResponseMetadata']
@flannon
flannon / dynamodb-local-startup.sh
Created November 25, 2016 16:15
dynamodb-local-startup
#!/bin/bash
# After installing dynamodb-local with brew you can start it with
# the following command
#
java -Djava.library.path=/usr/local/Cellar/dynamodb-local/2016-05-17/libexecynamoDBLocal_lib -jar /usr/local/Cellar/dynamodb-local/2016-05-17/libexec/DynamoDBLocal.jar -port 9000 -dbPath /opt/dynamodb-local
@flannon
flannon / Cloudformation cross stack security group with exported GroupId
Created December 11, 2016 14:04
Cloudformation cross stack security group with exported GroupId
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Cross stack security group'
Resources:
egress1:
Type: AWS::EC2::SecurityGroupEgress
Properties:
CidrIp: 0.0.0.0/0
GroupId:
Ref: sgTESTY22
IpProtocol: '-1'
@flannon
flannon / instance snippet
Created December 11, 2016 14:08
Cloudformation AWS::EC2::Instance calling cross stack exported GroupId
myInstance:
Type: AWS::EC2::Instance
Properties:
ImageId:
Fn::FindInMap:
- RegionMap
- Ref: AWS::Region
- AMI
InstanceType: t1.micro
KeyName:
scp -oProxyCommand="ssh -W %h:%p <user>@<host>" <file> <user>@<host>:<path>
@flannon
flannon / test ssl chain with openssl
Last active March 16, 2017 14:10
Test ssl chain with openssl
openssl s_client -showcerts -connect <host>:443
curl -s -D - < URL > -o /dev/null | grep -E "Date|Expires"
git config --global core.editor $(which vim)
Jq notes
Show names and ids of all efs file systems
$ aws efs describe-file-systems | jq '.FileSystems[] | {FileSystems: .Name, FileSystemId}'
Select a single file system based on its name tag,
$ aws efs describe-file-systems | jq '.FileSystems[] | select(.Name == "my_fs_name")'