This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
def pull_s3_prefix(dst_dir, bucket, prefix): | |
client = boto3.client('s3') | |
resource = boto3.resource('s3') | |
download_dir(client, resource, prefix, prefix, dst_dir, bucket) | |
def download_dir(client, resource, prefix, start_prefix, local, bucket ): | |
paginator = client.get_paginator('list_objects') | |
for result in paginator.paginate(Bucket=bucket, Delimiter='/', Prefix=prefix): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import os | |
import zipfile | |
import glob | |
import logging | |
import shutil | |
logger = logging.getLogger() | |
logger.setLevel(logging.INFO) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import boto3 | |
import sys | |
#### | |
#### usage copy_dynamo_items.py <srcTable> <dstTable> [dstTableRegion] [dstTableProfile] | |
#### source table region will get picked up from environment variables | |
#### if target table region is different than source region, pass it as 3rd argument to script | |
#### source table credentials are picked up from environment | |
#### if target table credentials are different from source, pass it as 4rd argument to the script as local profile name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#### | |
#### Delete (remove) all items from Aws Dynamo DB table, by specifing table name and primary key | |
#### | |
#### Forked from https://gist.github.com/k3karthic/4bc929885eef40dbe010 | |
#### | |
#### Usage: | |
#### clean-dynamo-table TABLE_NAME PRIMARY_KEY | |
#### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pynamodb.models import Model | |
from pynamodb.attributes import UnicodeAttribute, ListAttribute, MapAttribute | |
import os | |
import json | |
class BaseModel(Model): | |
def to_dict(self): | |
rval = {} | |
for key in self.attribute_values: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import boto3 | |
import os | |
from botocore.exceptions import ClientError | |
KEY_ID = 'aws_access_key_id' | |
SECRET_KEY = 'aws_secret_access_key' | |
SESSION_TOKEN = 'aws_session_token' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import os | |
import boto3 | |
import shlex | |
def rotate(profile: str): | |
sts = boto3.client('sts') | |
iam = boto3.client('iam') | |
user_arn = sts.get_caller_identity()['Arn'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
//run by default on docker-in-docker slave | |
agent { | |
label 'docker' | |
} | |
stages { | |
//demo of running builds within custom container | |
stage('PrintNodeVersion') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eox pipefail | |
if [ "$1" == "" ]; then | |
echo "usage: assume-role arn [session-name=nikolatosic\$(date +%s)] [duration=900]" | |
exit 1 | |
fi | |
if [ "$2" == "" ]; then | |
echo "usage: assume-role arn [session-name\$(date +%s)] [duration=900]" | |
session_name="nikolatosic$(date +%s)" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
physical_id = get_physical_id(event) | |
if request_type == 'Create' or request_type == 'Update: | |
if resource_exists(physical_id): | |
print(f'{physical_id} will be overwritten') | |
create_resource() | |
response.success(physical_id) |
NewerOlder