Skip to content

Instantly share code, notes, and snippets.

@adamstauffer
adamstauffer / delete_ecs_services.py
Last active February 26, 2020 07:55
Delete all services in an ECS cluster using boto3
"""Delete all services in an ECS Cluster using boto3.
Requires listing all services in a cluster, setting their desired tasks to 0,
then deleting the service.
"""
import boto3
CLUSTER_NAME = 'your-cluster-here'
import requests
from requests.auth import HTTPBasicAuth
import re
from StringIO import StringIO
JIRA_URL = 'https://your-jira-url.tld/'
JIRA_ACCOUNT = ('jira-username', 'jira-password')
# the JIRA project ID (short)
JIRA_PROJECT = 'PRO'
GITLAB_URL = 'http://your-gitlab-url.tld/'
@darvid
darvid / sqstop.sh
Created July 26, 2016 14:01
Realtime graph of AWS SQS queue size
#!/bin/bash
INTERVAL=2s
queues=$(aws sqs list-queues | jq -r '.QueueUrls[]')
queue_url=$(echo "$queues" | egrep "\/$1\$")
if [ -z $queue_url ]
then
>&2 echo "invalid queue name"
exit 1
fi
declare -a y
@thomasst
thomasst / migrate-redis.py
Created May 14, 2015 18:26
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.