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 | |
# From private repo : https://github.com/D4UDigitalPlatform/cloudscripts/blob/master/aws/scripts/cloudwatch/cw-annotation.sh | |
# Dependencies : aws cli, jq | |
# This script is used to add vertical annotations (like a timed event) to an existing widget inside a CloudWatch Dashboard. | |
# It is similar to https://github.com/anaynayak/aws-cloudwatch-annotations | |
# But do not need NodeJS, only Bash, AWS CLI and jq. | |
function usage() { | |
cat << EOF | |
cw-annotation.sh -d DASHBOARDNAME -w WIDGETNAME -t LABEL |
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
''' | |
This function send Application Load Balancer logs to CloudWatch Logs. So you can use CloudWatch tools, like Insight or custom metrics. | |
By default, ALB log its access in gz file in S3, and there is no way yo send the log directly to a Log Group / Log Stream. | |
This lambda function is triggered on S3 "PUT" action (when ALB write its log file). It then download the file localy, unzip it, sort it, and stream it to a CloudWatch log groups. | |
Installation | |
Activate ALB logs, and indicate the S3 bucket and the prefix for the log files. Enable, on the bucket, the deletion of old log files |
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
''' | |
This function send CloudFront logs to CloudWatch Logs. So you can use CloudWatch tools, like Insight or custom metrics. | |
By default, CloudFront log its access in gz file in S3, and there is no way yo send the log directly to a Log Group / Log Stream. | |
This lambda function is triggered on S3 "PUT" action (when CloudFront write its log file). It then download the file localy, unzip it, sort it, and stream it to a CloudWatch log groups. | |
Installation | |
Activate CloudWatch logs, and indicate the S3 bucket and the prefix for the log files. Enable, on the bucket, the deletion of old log files | |
(because log files will be now in Cloudwatch, it is not necessary to keep them in S3). | |
Install the Lambda function on the region of your S3 bucket. Grant permission of this function to read the S3 and to create Log group and stream. |
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
### | |
### This gist contains 2 files : settings.json and lambda_function.py | |
### | |
### settings.json | |
{ | |
"extensions" : ["*.hdr", "*.glb", "*.wasm"] | |
} | |
### lambda_function.py |
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/sh | |
# Always checkout last version from https://github.com/D4UDigitalPlatform/cloudscripts/tree/master/aws/scripts/cloudfront | |
show_help() { | |
cat << EOF | |
Usage: | |
${0##*/} [--verbose] [--cloudfrontid CLDFID] [--cname CNAME] [--list] | |
Purge a CloudFront distribution. | |
options : |
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 | |
# you will need http://github3py.readthedocs.org/en/latest/#installation | |
# I'm not sure if this works on Windows due to the use of strptime() | |
# Based on https://gist.github.com/morido/9817399 | |
# Improvement : take user, pass and orga from command line + use the new github3 API | |
from github3 import login | |
import datetime | |
import json | |
import pprint |
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
''' | |
List all inactive user of a GitHub organization | |
See user.py --help for usage. | |
Partially inspired by https://gist.github.com/morido/9817399 | |
''' | |
import sys # to use sys.stdout | |
import os | |
from datetime import datetime | |
from time import strftime | |
import datetime |