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
python3 -c "import boto3; creds = boto3.Session().get_credentials().get_frozen_credentials(); print(f'AWS_ACCESS_KEY_ID={creds.access_key}\nAWS_SECRET_ACCESS_KEY={creds.secret_key}\nAWS_SESSION_TOKEN={creds.token}')" |
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
# Boto3 examples showing difference between client and resource | |
# | |
import boto3 | |
from boto3.dynamodb.conditions import Key | |
from botocore.config import Config | |
from pprint import pprint | |
my_config = Config( | |
region_name = 'us-east-1' |
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
// variable 'user' stores the social oauth response through Cognito User Pool | |
const client = new S3({ | |
region: "<REGION>", | |
credentials: fromCognitoIdentityPool({ | |
identityPoolId: "<IDENTITY POOL ID>", | |
logins: { | |
"cognito-idp.<REGION>.amazonaws.com/<USER POOL ID>": user.signInUserSession.idToken.jwtToken, | |
}, | |
clientConfig: { region: "<REGION>" }, |
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 | |
# list running instances | |
aws ec2 describe-instances --query 'Reservations[].Instances[].[InstanceId,Placement.AvailabilityZone,Tags[].Value]' --filters "Name=instance-state-name,Values=running" --region us-east-2 |
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
from boto.s3.connection import S3Connection | |
# cache-control metadata | |
meta = {'Cache-Control':'max-age=43200'} | |
connection = S3Connection(KEY, SECRET) | |
bucket = connection.get_bucket('mui.test.bucket') | |
key = bucket.lookup('sourcefile.tar') | |
chunk = 99999999 |
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
from boto.s3.connection import S3Connection | |
# make sure api creds set, KEY/SECRET are just placeholders | |
connection = S3Connection(KEY, SECRET) | |
bucket = connection.get_bucket("just.a.test.bucket.really") | |
keys = bucket.get_all_keys() | |
for key in keys: | |
key.set_metadata('Cache-Control','max-age=43200') | |
key.copy( |
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
Resources: | |
AWSEBLoadBalancer: | |
Type: "AWS::ElasticLoadBalancing::LoadBalancer" | |
Properties: | |
HealthCheck: | |
Target: "HTTP:80/health.html" |