This file contains hidden or 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
''' | |
This is an example of how to send data to Slack webhooks in Python with the | |
requests module. | |
Detailed documentation of Slack Incoming Webhooks: | |
https://api.slack.com/incoming-webhooks | |
''' | |
import json | |
import requests |
This file contains hidden or 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 | |
# | |
# More of a reference of using jinaj2 without actual template files. | |
# This is great for a simple output transformation to standard out. | |
# | |
# Of course you will need to "sudo pip install jinja2" first! | |
# | |
# I like to refer to the following to remember how to use jinja2 :) | |
# http://jinja.pocoo.org/docs/templates/ | |
# |
This file contains hidden or 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
auto_auth { | |
method { | |
type = "aws" | |
config = { | |
type = "ec2" | |
role = "web" | |
} | |
} | |
sink { |
This file contains hidden or 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
log_level = "info" | |
vault { | |
address = "_VAULT_ADDR_" | |
vault_agent_token_file = "/home/ec2-user/.vault-token" | |
# unwrap_token = true | |
# renew_token = true |
This file contains hidden or 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 pprint | |
pp = pprint.PrettyPrinter(indent=5, width=80, compact=False) | |
#http://docs.aws.amazon.com/general/latest/gr/rande.html | |
regions = ['us-east-1', 'us-west-2', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1', 'eu-central-1', 'eu-west-1'] | |
''' |
This file contains hidden or 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 botocore | |
import datetime | |
import progressbar | |
import itertools | |
# from https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html | |
STORAGE_TYPES = [ | |
"StandardStorage", | |
"IntelligentTieringStorage", |
This file contains hidden or 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 | |
from datetime import date | |
from datetime import datetime | |
today = date.today() | |
today = datetime.combine(today, datetime.min.time()) | |
client = boto3.client('s3') | |
# Get all buckets | |
response = client.list_buckets() |
This file contains hidden or 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 os | |
import boto3 | |
s3Client = boto3.client('s3') | |
buckets = s3Client.list_buckets() | |
DAYS = int(os.environ['DAYS']) | |
def setType(key): | |
if key == "NoncurrentVersionTransitions": |