Skip to content

Instantly share code, notes, and snippets.

@andreas-wilm
Created October 24, 2018 02:20
Show Gist options
  • Save andreas-wilm/732598f065022b1ab88c5aa89d56a39b to your computer and use it in GitHub Desktop.
Save andreas-wilm/732598f065022b1ab88c5aa89d56a39b to your computer and use it in GitHub Desktop.
Populate default AWS profile from CSV
#!/bin/bash
csv=$1
test -z "$csv" && exit 1
test -e "$csv" || exit 1
grep -q '^AccessKeyId' $csv || exit 1
test $(cat "$csv" | wc -l) -eq 2 || exit 1
akid=$(tail -n1 $csv | cut -d',' -f 2)
sak=$(tail -n1 $csv | cut -d',' -f 2)
aws configure set aws_access_key_id $akid
aws configure set aws_secret_access_key $sak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment