Skip to content

Step 2: Set up access

Your AWS administrator deploys LayerZero's template once, creating the key, the bucket and the role the onboarding tool uses.

On this page

Your AWS administrator does this once, in your validator's Region. It deploys one CloudFormation stack, zero-onboarding, which gives the onboarding tool a place in your account to work and to keep your keys. It takes a few minutes.

The stack contains:

  • a KMS key that seals your validator keys;
  • an S3 bucket that stores them, sealed;
  • a small private network (a VPC) for the machines the tool creates;
  • the zero-onboarding role the tool runs as. Only the people you name can use it.

Security model describes each of these, and what they're allowed to do.

2a. Save LayerZero's template

After Step 1, this writes the template to a file, zero-onboarding.yaml, so you can read it before deploying. Your AWS CLI looks up who you are, and the tool writes that into the template, so only you can use the role it creates. The tool gets no AWS credentials and no network access, and nothing in your account changes.

docker run --rm --network none "$IMAGE" access-template \
  --principals "$(aws sts get-caller-identity --query Arn --output text)" > zero-onboarding.yaml

If someone else will run Steps 3 and 4

The role is limited to the people named in the template. Run 2a as the person who will run the later steps, or name several people at once, separated by commas, each as aws sts get-caller-identity --query Arn prints it for them:

docker run --rm --network none "$IMAGE" access-template \
  --principals "<your ARN>,<operator's ARN>" > zero-onboarding.yaml

If you name a role, such as an AWS SSO permission set, anyone who signs in through that role can use it. The root user can't be named.

2b. Deploy it

aws cloudformation deploy --stack-name zero-onboarding --template-file zero-onboarding.yaml \
  --capabilities CAPABILITY_NAMED_IAM --region "$AWS_REGION"

When it's done, you see Successfully created/updated stack - zero-onboarding.

To keep administrator credentials off the operator's machine, deploy from CloudShell, a terminal inside the AWS console:

  1. Sign in to the AWS console as your administrator, switch to your validator's Region, and open CloudShell (the >_ icon at the top).
  2. Choose Actions → Upload file and upload zero-onboarding.yaml.
  3. Paste the export AWS_REGION=… line from your invite. CloudShell's own AWS_REGION may be a different Region.
  4. Run the deploy command above.

The operator's own sign-in then only needs permission to assume arn:aws:iam::<your account>:role/zero-onboarding, and to pull images (ecr:GetAuthorizationToken, ecr:BatchGetImage and ecr:GetDownloadUrlForLayer).

Using your own subnet

By default the stack creates its own small VPC. To use a subnet you already have instead, add its IDs to the deploy command. It must be a public subnet, with a route to an internet gateway.

aws cloudformation deploy --stack-name zero-onboarding --template-file zero-onboarding.yaml \
  --capabilities CAPABILITY_NAMED_IAM --region "$AWS_REGION" \
  --parameter-overrides SubnetId=<subnet ID> VpcId=<its VPC ID>

Changing who can use the role later

Redeploying keeps the people named the first time. To change them, generate the template again with the new --principals and deploy it with the --parameter-overrides 'OnboardingPrincipals=…' line the command prints.

Next

Step 3: Generate your keys.