A set of scripts to help you create a central bucket in an account to store an init.sh script for cloudshell to use.
Filename | Description |
---|---|
create_bucket.ps1 | Powershell script to create the bucket and copy up the script |
delete_bucket.ps1 | Powershell script to delete the bucket |
update_init_script.ps1 | Powershell script to only copy the init.sh into the bucket for updates |
init.sh | the script to run on cloudshell that is stored in the bucket |
Each ps1 script has a profile variable at the top you need to change to the profile you want to use.
Run the create_bucket.ps1 first. This will create the bucket and two files in the local folder:
- bucketname.txt
- cloudshell_command.txt
Open cloudshell and then copy and paste the command from cloudshell_command.
Done. Your shell is now configured with the things you want.
This file contains the command you run on your cloudshell. an example is:
sudo aws s3 cp s3://setup-cloudshell-y4uqexrt/init.sh ~/init.sh && sudo chmod +x ~/init.sh && sudo ~/init.sh
Currently the init.sh will install golang and clone the useful repositories for managing cloud estates at scale. this is a WIP.
# Install Golang
sudo yum install golang
# Clone the cli stuff
git clone https://github.com/stormlrd/aws-federated-python-awscli-skeleton.git
git clone https://github.com/stormlrd/aws-federated-headless-login.git
git clone https://github.com/stormlrd/aws-federated-identity-scraper.git
cd aws-federated-headless-login/
go build -buildvcs=false
- Make init.sh more robust with prompts instead of just being mindless
Q: How do I make this run it every time I log in to the shell
A: Edit the shells .bashrc file and add ./init.sh at the end. note that as ~/ is persistent storage things like the git clone will error as the folders will already exist.
Q: My CloudShell does not seem to have my init.sh in it?
A: Did you change region? Each region will make Cloudshell have a new persistent storage for ~/ so you need to run the cloudshell_command.txt command in each region you want to use cloudshell. Painful I know, which is why you should look into the centralised approach instead.
Q: Do I need to create this bucket per region in the same account?
A: No.
Q: Should I create a bucket per account?
A: This solution will over write the local files. it is not built for multi-account deployments. The idea is that one cloudshell should be able to be used to manage all your accounts and all regions anyway so look into the federated identity stuff I put into the init.sh and the world will become your oyster...