Skip to content

Instantly share code, notes, and snippets.

@parijatmishra
parijatmishra / boto3_cloudsearch_examples.py
Created February 17, 2016 03:54
boto3 - cloudsearch - describe_domains() and describe_index_fields()
import boto3
client = boto3.client('cloudsearch')
# List properties of all domains
print "List all domains"
domains = []
response = client.describe_domains()
for domain in response['DomainStatusList']:
domain_name = domain['DomainName']
@parijatmishra
parijatmishra / ddb_lsi_example.py
Created February 10, 2016 11:51
Using DynamoDB Local Secondary Indexes - example in Python and boto3
#!/usr/bin/env python
# ddb_lsi_example: A sample program to show how to use Local Secondary Indexes
# in DynamoDB, using Python and boto3.
#
# Copyright 2016 Parijat Mishra
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@parijatmishra
parijatmishra / raid_ephemeral.sh
Created June 28, 2014 14:51
Bash: AWS: EC2: Make an RAID of all ephemeral drives
#!/bin/bash
#
# this script will attempt to detect any ephemeral drives on an EC2 node and create a RAID-0 stripe
# mounted at /mnt. It should be run early on the first boot of the system.
#
# Beware, This script is NOT fully idempotent.
#
METADATA_URL_BASE="http://169.254.169.254/2012-01-12"
RAID_MOUNT_DIR="/mnt/md0"