Skip to content

Instantly share code, notes, and snippets.

@wbirkmaier
wbirkmaier / aws_cli_paginator.sh
Created December 16, 2020 22:10 — forked from marjamis/aws_cli_paginator.sh
A simple sample of running the AWS CLI which will take consideration of pagination to get all results.
#!/bin/bash -xe
# Below command can be replaced to the required CLI, including with custom JSON output, assuming the NextToken is in the same location.
AWS_CLI_COMMAND="aws elasticbeanstalk list-platform-versions --max-records 100 --query={NextToken:NextToken,PlatformARNs:PlatformSummaryList[*].PlatformArn}"
OUTPUT_FILE="./output-$(date +%s)"
function CLI_call() {
if [ ! -v NEXT_TOKEN ]; then
cli_output=$($AWS_CLI_COMMAND)
else
@wbirkmaier
wbirkmaier / s3_multipart_upload.py
Created December 4, 2020 19:42 — forked from teasherm/s3_multipart_upload.py
boto3 S3 Multipart Upload
import argparse
import os
import boto3
class S3MultipartUpload(object):
# AWS throws EntityTooSmall error for parts smaller than 5 MB
PART_MINIMUM = int(5e6)
@wbirkmaier
wbirkmaier / function.py
Created February 27, 2020 22:19 — forked from brandond/function.py
Python script to auto-tag AWS EBS Snapshots and Volumes using AMI and Instance tags
import copy
import logging
import os
import boto3
logging.basicConfig(level=os.environ.get('LOG_LEVEL', 'INFO'))
ec2 = boto3.client('ec2')
logger = logging.getLogger(__name__)