Skip to content

Instantly share code, notes, and snippets.

@brunopadz
Created May 15, 2018 18:15
Show Gist options
  • Save brunopadz/a1927bcdfeea271d46bca08f16b44333 to your computer and use it in GitHub Desktop.
Save brunopadz/a1927bcdfeea271d46bca08f16b44333 to your computer and use it in GitHub Desktop.
Install awscli then copy files to S3
#!/bin/bash
AWSEXEC=`which aws`
AWSPATH=~/.aws/
PIPEXEC=`which pip`
function InstallAWS(){
if [ -a "$PIPEXEC" ]; then
$PIPEXEC install awscli --user --upgrade
else
echo "You must install pip before continue"
echo "Check https://docs.aws.amazon.com/pt_br/cli/latest/userguide/installing.html for further instructions"
fi
}
function ConfigureAWS(){
. ~/.bashrc
. ~/.profile
mkdir $AWSPATH
touch $AWSPATH/credentials
cat << EOF > $AWSPATH/credentials
[lmbr]
aws_access_key_id = KEY
aws_secret_access_key = KEY
region = sa-east-1
EOF
}
function CopyJAR(){
echo "Copying motorpromocoes"
echo "Copying campanhas"
echo "Copying businessobject"
}
echo "Is awscli present?"
if [ -d "$AWSPATH" ]; then
ConfigureAWS
CopyJAR
else
echo "Installing awscli"
InstallAWS
ConfigureAWS
CopyJAR
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment