Set Up Cloud Environment for AWS

This guide will walk you through setting up the necessary environment that you will use throughout your installation to create cloud resources on AWS.

Choose one of the following options to set up your cloud environment:

What You'll Need

Option 1: Set Up Cloud Environment for AWS Automatically (preferred)

Set up your cloud environment for AWS by following the on-screen instructions on the rok-deploy user interface.

If rok-deploy is not already running, start it with:

root@rok-tools:~# rok-deploy --run-from envvars-aws
../../../_images/envvars-aws.png

Proceed to the Summary section.

Option 2: Set Up Cloud Environment for AWS Manually

If you want to set up your cloud environment for AWS manually, follow the instructions below.

Procedure

  1. Go to your GitOps repository, inside your rok-tools management environment:

    root@rok-tools:~# cd ~/ops/deployments
    
  2. Retrieve the AWS account ID:

    root@rok-tools:~/ops/deployments# export AWS_ACCOUNT_ID=$(aws sts get-caller-identity \
    > | jq -r '.Account')
    
  3. Retrieve the default region for your profile in your AWS CLI configuration:

    root@rok-tools:~/ops/deployments# export AWS_DEFAULT_REGION=$(aws configure get region)
    
  4. (Optional) In case you already have a custom AWS configuration profile you want to use over the default one, export the AWS_PROFILE environment variable by replacing <CUSTOM_PROFILE> with your AWS profile:

    root@rok-tools:~/ops/deployments# export AWS_PROFILE=<CUSTOM_PROFILE>
    
  5. Save your state:

    root@rok-tools:~/ops/deployments# j2 deploy/env.envvars-aws.j2 -o deploy/env.envvars-aws
    
  6. Commit your changes:

    root@rok-tools:~/ops/deployments# git commit -am "Set Up Cloud Environment for AWS"
    
  7. Mark your progress:

    root@rok-tools:~/ops/deployments# export DATE=$(date -u "+%Y-%m-%dT%H.%M.%SZ")
    
    root@rok-tools:~/ops/deployments# git tag \
    > -a deploy/${DATE?}/release-1.4/envvars-aws \
    > -m "Set Up Cloud Environment for AWS"
    

Verify

  1. Go to your GitOps repository, inside your rok-tools management environment:

    root@rok-tools:~# cd ~/ops/deployments
    
  2. Restore the required context:

    root@rok-tools:~/ops/deployments# source <(cat deploy/env.envvars-aws)
    
    root@rok-tools:~/ops/deployments# export AWS_ACCOUNT_ID AWS_DEFAULT_REGION AWS_PROFILE
    
  3. Obtain your AWS account ID via the AWS CLI:

    root@rok-tools:~/ops/deployments# AWS_CONFIG_ACCOUNT_ID=$(aws sts get-caller-identity \
    > | jq -r '.Account')
    
  4. Ensure that the AWS account ID obtained via the AWS CLI matches the value of AWS_ACCOUNT_ID:

    root@rok-tools:~/ops/deployments# [[ ${AWS_ACCOUNT_ID?} == ${AWS_CONFIG_ACCOUNT_ID?} ]] \
    > && echo OK \
    > || echo FAIL
    OK
    
  5. Obtain the default AWS region for your profile in your AWS CLI configuration:

    root@rok-tools:~/ops/deployments# AWS_CONFIG_DEFAULT_REGION=$(aws configure get region)
    
  6. Ensure that the default AWS region obtained via the AWS CLI matches the value of AWS_DEFAULT_REGION:

    root@rok-tools:~/ops/deployments# [[ ${AWS_DEFAULT_REGION?} == \
    > ${AWS_CONFIG_DEFAULT_REGION?} ]] \
    > && echo OK \
    > || echo FAIL
    OK
    
  7. (Optional) If you have set a custom AWS configuration profile, inspect AWS_PROFILE and verify that it holds the name of your custom AWS profile:

    root@rok-tools:~/ops/deployments# echo ${AWS_PROFILE?}
    arrikto-profile
    

Summary

You have successfully configured environment variables that you will later need to generate names for resources.

What's Next

The next step is to configure access to Arrikto's private container registry.