Use with other tools
Your aliases work far beyond hop. There are two ways to use them elsewhere.
Option 1: AWS profiles
Section titled “Option 1: AWS profiles”Every alias of a company portal is a profile in ~/.aws/config with the same
name, so anything that understands AWS profiles can use it:
aws s3 ls --profile acme-prodAWS_PROFILE=acme-prod terraform planAWS_PROFILE=acme-prod npm run deploy # an app using the AWS SDKIn Terraform:
provider "aws" { profile = "acme-prod"}In the AWS Toolkit for VS Code or JetBrains, pick the profile from the list.
For a personal account the profile is
cloudhop-<source name> (for example cloudhop-personal), the one aws login
signs in to.
The tool reads the session cloudhop saved. If it has expired, run any hop
command or cloudhop login acme to renew it, then try again.
Option 2: cloudhop exec
Section titled “Option 2: cloudhop exec”cloudhop exec runs any command with the alias’ temporary credentials in the
environment, and renews the session first if needed:
cloudhop exec acme-prod -- terraform applycloudhop exec acme-prod -- python deploy.pycloudhop exec acme-prod --region eu-west-1 -- cdk deployThe command receives AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,
AWS_SESSION_TOKEN, AWS_REGION and AWS_DEFAULT_REGION. Use this for
tools that don’t read profiles, or when you want a sign-in guaranteed before
a long run.
Which one should I use?
Section titled “Which one should I use?”| Situation | Use |
|---|---|
| Interactive work with the AWS CLI | hop acme-prod ... |
| Tools that support profiles (Terraform, SDKs, IDEs) | AWS_PROFILE=acme-prod or the tool’s profile setting |
| Tools that only read environment variables | cloudhop exec acme-prod -- ... |
| A long job that must not fail on an expired session | cloudhop exec acme-prod -- ... |