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
from io import BytesIO | |
import gzip | |
import shutil | |
def upload_gzipped(bucket, key, fp, compressed_fp=None, content_type='text/plain'): | |
"""Compress and upload the contents from fp to S3. | |
If compressed_fp is None, the compression is performed in memory. | |
""" |
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 | |
# Usage `./replace-asg-instances.sh my-asg-name` | |
# Will set all instances to Unhealthy, so they are replaced by the ASG. | |
# Notice this is meant to work with EC2 health-check ASG, not ELB health-checks. | |
if [[ $1 == "" ]]; then | |
echo Usage "./replace-asg-instances.sh my-asg-name" | |
exit 1 | |
fi |
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/sh | |
# Use AWS CLI to get the most recent version of an AMI that | |
# matches certain criteria. Has obvious uses. Made possible via | |
# --query, --output text, and the fact that RFC3339 datetime | |
# fields are easily sortable. | |
export AWS_DEFAULT_REGION=us-east-1 | |
aws ec2 describe-images \ |
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
# Assuming an Ubuntu Docker image | |
$ docker run -it <image> /bin/bash |