Deploying to AWS
Data Workspace contains code that helps it be deployed using Amazon Web Services (AWS). This page explains how to use this code.
Prerequisites
To deploy Data Workspace to AWS you must have:
- The source code of Data Workspace cloned to a folder
data-workspace
. See Running locally for details - An AWS account
- Terraform installed
- An OAuth 2.0 server for authentication
You should also have familiarity with working on the command line, working with Terraform, and with AWS.
Environment folder
Each deployment, or environment, of Data Workspace requires a folder for its configuration. This folder should be within a sibling folder to data-workspace
.
The Data Workspace source code contains a template for this configuration. To create a folder in an appropriate location based on this template:
-
Decide on a meaningful name for the environment. In the following
production
is used. -
Ensure you’re in the root of the
data-workspace
folder that contains the cloned Data Workspace source code. -
Copy the template into a new folder for the environment:
mkdir -p ../data-workspace-environments cp -Rp infra/environment-template ../data-workspace-environments/production
This folder structure allows the configuration to find and use the infra/
folder in data-workspace
which contains the low level details of the infrastructure to provision in each environment.
Initialising environment
Before deploying the environment, it must be initialised.
-
Change to the new folder for the environment:
cd ../data-workspace-environments/production
-
Generate new SSH keys:
./create-keys.sh
-
Install AWS CLI and configure an AWS CLI profile. This will support some of the included configuration scripts.
You can do this by putting credentials directly into
~/.aws/credentials
or by usingaws sso
. -
Create an S3 bucket and dynamodb table for Terraform to use, and add them to
main.tf
.--bucket
will provide the base name for both objects../bootstrap-terraform.sh \ --profile <value> \ --bucket <value> \ --region <value>
-
Enter the details of your hosting platform, SSH keys, and OAuth 2.0 server by changing all instances of
REPLACE_ME
in:admin-environment.json
gitlab-secrets.json
main.tf
-
Initialise Terraform:
terraform init
Deploying environment
Check the environment you created has worked correctly:
terraform plan
If everything looks right, you’re ready to deploy:
terraform apply