Skip to content

Instantly share code, notes, and snippets.

@jokeru
jokeru / aws_delete-default-vpc.sh
Created March 31, 2018 15:14
Script to delete all AWS default VPCs from all regions using AWS CLI
#!/usr/bin/env bash
if [ "$AWS_PROFILE" = "" ]; then
  echo "No AWS_PROFILE set"
  exit 1
fi
for region in $(aws ec2 describe-regions --region eu-west-1 | jq -r .Regions[].RegionName); do
@pahud
pahud / delete_all_awslogs.sh.md
Last active October 18, 2023 09:13
delete all aws log groups

specify the region

export AWS_DEFAULT_REGION=ap-northeast-1
aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | \
awk '{print $2}' | grep -v ^$ | while read x; do  echo "deleting $x" ; aws logs delete-log-group --log-group-name $x; done

only delete loggroup name starting with /aws/lambda

@jaimesromero
jaimesromero / bidirectional_sync_s3.md
Last active December 19, 2018 16:28
Bidirectional sync between two s3 buckets

1. Copy new files in [ENV]-wowzer-iphone to [ENV]-wowza-repository

1.1 Configure the SNS topic

1.1.1 Create a new SNS topic

Create a new SNS topic with name: [ENV]-wowzer-iphone-fanout

1.1.2 Update SNS topic policy

@s-fujimoto
s-fujimoto / s3-to-es-lamba.py
Created November 14, 2015 15:57
Import Elasticsearch from ELB access log for AWS Lambda Function
##################################################
### Elasticsearch host name
ES_HOST = "search-******************.ap-northeast-1.es.amazonaws.com"
### Elasticsearch prefix for index name
INDEX_PREFIX = "awslogs"
#################################################
### ELB access log format keys
ELB_KEYS = ["timestamp", "elb", "client_ip", "client_port", "backend_ip", "backend_port", "request_processing_time", "backend_processing_time", "response_processing_time", "elb_status_code", "backend_status_code", "received_bytes", "sent_bytes", "request_method", "request_url", "request_version", "user_agent"]