Wrapping some useful AWS cli commands to operate some services like EC2, SSO and more
In your terminal, set the corresponding AWS_PROFILE=MyProfile if not using the default. (~/.aws/credentials). Copy this helper function called aws-profile into your favourite shell (.bashrc, .zshrc, ~/.config/fish/function) to easily switch between AWS profiles. In case of using fish shell, use this other function.
Install the REQUIRED plugin to use SSM sessions.
cloudsnake ssm start-session -is # will print all your instances in a terminal menu
cloudsnake ssm start-session --target i-XXXXXX # connect to the instance specifying the target idcloudsnake ssm get-parameter # default region eu-west-1
cloudsnake --region us-east-1 ssm get-parameters # specify regioncloudsnake --region eu-west-1 sso get-credentials --start-url https://myapp.awsapps.com/startNote
This command will open your default browser. You will need to approve manually the authentication.
More use cases and examples for cloudsnake sso get-credentials can be found in docs/sso-get-credentials.md.
Install pipx with your system package manager (apt, dnf, pacman...).
pipx install cloudsnakepip3 install cloudsnakeWarning
Probably your system will not allow this installation method due to a broken system package.
Example error
Error:
error: externally-managed-environment× This environment is externally managed ╰─> To install Python packages system-wide, try 'pacman -S python-xyz', where xyz is the package you are trying to install.
If you wish to install a non-Arch-packaged Python package, create a virtual environment using 'python -m venv path/to/venv'. Then use path/to/venv/bin/python and path/to/venv/bin/pip. If you wish to install a non-Arch packaged Python application, it may be easiest to use 'pipx install xyz', which will manage a virtual environment for you. Make sure you have python-pipx installed via pacman.note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification.
pipx uninstall cloudsnake
# or
pip3 uninstall cloudsnakecloudsnake --log-level debug command subcommand [options]cloudsnake is distributed under the terms of the GPL3 license.



