Skip to content

Instantly share code, notes, and snippets.

View mkostrikin's full-sized avatar

Maxim N. Kostrikin mkostrikin

View GitHub Profile
@mkostrikin
mkostrikin / aws-creds.bash
Created April 27, 2017 10:30 — forked from ddgenome/aws-creds.bash
Fetch AWS STS keys and set environment variables
#!/bin/bash
# Fetch 24-hour AWS STS session token and set appropriate environment variables.
# See http://docs.aws.amazon.com/cli/latest/reference/sts/get-session-token.html .
# You must have jq installed and in your PATH https://stedolan.github.io/jq/ .
# Add this function to your .bashrc or save it to a file and source that file from .bashrc .
# Usage: aws-creds MFA_TOKEN [OTHER_AWS_STS_GET-SESSION-TOKEN_OPTIONS]
function aws-creds () {
if [[ ! $1 ]]; then
echo "aws-creds: missing required argument: MFA_TOKEN_CODE" 1>&2
apt-get update
apt-get install curl
curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main 9.4 | sudo tee /etc/apt/sources.list.d/postgres.list
#percona mysql
sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
echo deb http://repo.percona.com/apt trusty main | sudo tee /etc/apt/sources.list.d/percona.list