Skip to content

Instantly share code, notes, and snippets.

sysboss /
Created May 21, 2018
SQL Query Amazon Athena using Python
#!/usr/bin/env python3
# Query AWS Athena using SQL
# Copyright (c) Alexey Baikov <sysboss[at]>
# This snippet is a basic example to query Athen and load the results
# to a variable.
# Requirements:
# > pip3 install boto3 botocore retrying
sysboss /
Created Aug 21, 2017
Get all EC2 tags and set them as Bash variables
# EC2 tags to variables
# Copyright (c) Alexey Baikov <sysboss[at]>
# Description:
# Gets all EC2 tags and converts them to Bash variables
# Based on 'jq' (
INSTANCE_REGION="$(curl -s | grep region | tr -d ' ' | cut -f2 -d: | tr -d '"' | tr -d ',')"
gene1wood /
Created Dec 29, 2016
Simple python function to assume an AWS IAM Role from a role ARN and return a boto3 session object
import boto3
def role_arn_to_session(**args):
Usage :
session = role_arn_to_session(
client = session.client('sqs')
eladnava /
Last active Aug 21, 2021
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
# Make sure to:
# 1) Name this file `` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x
# 7) Test it out via ./

Modifying an Existing Docker Image

To install a custom package or modify an existing docker image we need to

  1. run a docker a container from the image we wish to modify
  2. modify the docker container
  3. commit the changes to the container as a docker image
  4. test changes made to image

1.) Running a docker container from an image