Skip to content

Instantly share code, notes, and snippets.

View mims92's full-sized avatar

Mims mims92

  • Liege
View GitHub Profile
@mims92
mims92 / AWSCognitoGoogleIdp.yaml
Created October 19, 2021 20:41
AWS Cloudformation for Cognito with Google Idp
# Google IdP for AWS Cognito
# IdP: Only google
# auth type: code
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
GoogleClientId:
NoEcho: True
Type: String
GoogleClientSecret:
@mims92
mims92 / pre-sign.py
Last active February 8, 2021 08:59
AWS - Python - Pre Sign S3 key
# coding: utf-8
# Usage: python pre-sign.py -h
########################################
import boto3
import datetime
import sys, getopt
from botocore.client import Config
expiration = 93200
@mims92
mims92 / awsgetparams
Created September 18, 2020 11:48
AWS - Bash - Get SSM parameters by path, (un)encrypted
#!/bin/bash
#chmod +x /usr/bin/awsgetparams
#Usage: awsgetparam <path> <profile name> <EMTPY|Y|y>
#Output: list of param value
PARAM_PATH="$1"
shift
PROFILE="$1"
shift
@mims92
mims92 / awsgetparam
Created August 24, 2020 08:04
AWS - Bash - Get a single SSM parameter, (un)encrypted
#!/bin/bash
#chmod +x /usr/bin/awsgetparam
#Usage: awsgetparam <param-name> <profile name> <EMTPY|Y|y>
#Output: param value
PARAM_NAME="$1"
shift
PROFILE="$1"
shift
@mims92
mims92 / awsecs
Created July 27, 2020 10:46
AWS - Bash - Get tasks instances
#!/bin/bash
#chmod +x /usr/bin/awsecs
#Usage: awsecs <service-name> <profile name>
#Output: list of ec2 instance id
SERVICE="$1"
shift
PROFILE="$1"
shift
@mims92
mims92 / awsssm
Created January 3, 2020 08:51
AWS - Bash - Start session using SSM Session manager
#!/bin/bash
#chmod +x /usr/bin/awsssm
#Usage: awsssm <instance id> <profile name>
aws ssm start-session --target $1 --profile $2
@mims92
mims92 / awsec2
Last active January 30, 2020 09:42
AWS - Bash - List all EC2 instances
#!/bin/bash
#chmod +x /usr/bin/awsec2
#Usage: awsec2 <profile-name>
aws ec2 describe-instances --profile $1 | jq -r '.[][].Instances[] | [ .InstanceId, (.Tags[]|select(.Key=="Name")|.Value), (.NetworkInterfaces[].PrivateIpAddresses[].PrivateIpAddress)] | select (.!=null) | @tsv' | column -s$'\t' -t'
@mims92
mims92 / awsaccounts
Created January 3, 2020 08:43
AWS - Bash - List all accounts id and name of the organization
#!/bin/bash
#chmod +x /usr/bin/awsaccounts
#Usage: awsaccounts
aws organizations list-accounts --profile <profile name> | jq -r -e '["ID","", "NAME"], (.Accounts[] | [.Id, .Name] ) | @tsv'
@mims92
mims92 / aws-ec2.sh
Created November 18, 2019 10:26
AWS - Bash - List Instances
#!/bin/bash
#Usage: aws-ec2 <profile name>
aws ec2 describe-instances --profile $1 \
| jq -r '.[][].Instances[] | [ .InstanceId, (.Tags[]|select(.Key=="Name")|.Value), (.NetworkInterfaces[].PrivateIpAddresses[].PrivateIpAddress)]'
@mims92
mims92 / aws
Last active January 4, 2019 14:26
Linux - AWSCLI - aws cli with python3.6
# Requirement
# - https://gist.github.com/mims92/83b911783c2a23377c3f7dc9d1fe38b9
#--------
# Installation
# - Create the exectuable file under your PATH
#--------
# Files are being mounted in /app inside the container
#!/bin/bash