Step 1: Set up your terminal
Sign in to AWS, paste the three lines from your invite, and create the zero command. Repeat this in each new terminal.
On this page
Every later command runs in your AWS account through this terminal session. You set it up in three parts: sign in to AWS, paste the three lines from LayerZero's invite, and create a short zero command that runs the onboarding tool.
Nothing here is saved, so do it again in every new terminal, including when you come back for Step 4.
1a. Sign in to AWS
If you sign in to your validator's account with a named AWS profile (for example one made with aws configure sso), pick it first:
export AWS_PROFILE=<profile name>Then sign in the way you normally do, for example aws sso login. Check that you're in the right account: this prints the account's ID, which must be your validator account's.
aws sts get-caller-identity --query Account --output text1b. Paste the three lines from your invite
Your invite has three lines. Paste them from the email. They're shown here only so you know what to expect.
export AWS_REGION=<your validator's Region>
IMAGE=<LayerZero's account>.dkr.ecr.<LayerZero's Region>.amazonaws.com/zero-onboard@sha256:<digest>
aws ecr get-login-password --region <LayerZero's Region> | docker login --username AWS --password-stdin <LayerZero's account>.dkr.ecr.<LayerZero's Region>.amazonaws.com| Line | What it does |
|---|---|
AWS_REGION | The AWS Region your validator runs in. |
IMAGE | The exact version of the onboarding tool, pinned by its digest so it can't change under you. |
docker login | Uses your AWS sign-in to sign Docker in to LayerZero's registry, so it can download the tool. It prints Login Succeeded. The sign-in lasts 12 hours. |
1c. Create the zero command
Paste this function. It defines zero, a short command that runs the onboarding tool.
zero() {
local account creds
account=$(aws sts get-caller-identity --query Account --output text) || return
creds=$(aws sts assume-role --role-session-name zero-onboard \
--role-arn "arn:aws:iam::$account:role/zero-onboarding" \
--query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken,Expiration]' --output text) || return
docker run --rm -it -e AWS_REGION="${AWS_REGION:-$(aws configure get region)}" \
-e ZERO_ONBOARD_IMAGE="$IMAGE" \
--env-file <(printf '%s\n' "$creds" | awk '{print "AWS_ACCESS_KEY_ID=" $1; print "AWS_SECRET_ACCESS_KEY=" $2; print "AWS_SESSION_TOKEN=" $3; print "AWS_CREDENTIAL_EXPIRATION=" $4}') \
"$IMAGE" "$@"
}Each time you run it, it:
- uses your own AWS sign-in, on your machine, to switch to the
zero-onboardingrole that Step 2 creates; - hands the onboarding tool only that role's temporary credentials, which last an hour. The tool never sees your own credentials, and refuses to run with any others;
- passes your Region and the tool's version. Nothing else from your machine goes into it.
The zero command only works once Step 2 is done. Until then you'll see AccessDenied for AssumeRole.
Next
If your administrator hasn't set up access yet, continue with Step 2: Set up access. Otherwise go to Step 3: Generate your keys.