Skip to content

Instantly share code, notes, and snippets.

@thanakijwanavit
Last active June 23, 2021 14:34
Show Gist options
  • Save thanakijwanavit/860aeaa79a2ebe86c30c11d5e08c9e9d to your computer and use it in GitHub Desktop.
Save thanakijwanavit/860aeaa79a2ebe86c30c11d5e08c9e9d to your computer and use it in GitHub Desktop.
aws key installation in colab with aes pw encryption
from nicHelper.colab import autoSetupAws
from getpass import getpass
path = '/content/drive/MyDrive/.test'
autoSetupAws(path=path,
password = getpass('enter your password').encode(),
region='ap-southeast-1' )
!pip install -q nicHelper
!apt install --q awscli
from nicHelper.colab import saveAwsPw, autoSetupAws
from getpass import getpass
### only do this once then delete the password
saveAwsPw(awskey = b'test', awssecret=b'password', path = '/content/drive/MyDrive/.awsKey', password = b'test')
## this function encrypt awskey and secret with aes using your password
############
# load password and set it to aws
autoSetupAws(path='/content/drive/MyDrive/.awsKey',password = getpass().encode())
from nicHelper.colab import saveAwsPw
from getpass import getpass
awskey = getpass('enter your aws key').encode()
awssecret = getpass('enter your aws Secret').encode()
password = getpass('set your password').encode()
path = '/content/drive/MyDrive/.test'
saveAwsPw(awskey=awskey, awssecret=awssecret, path=path, password=password)
@thanakijwanavit
Copy link
Author

note that password needs to be the same when using autosetup as when using save

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment