|
1 | 1 | ---
|
2 |
| -title: Deploy on Amazon EC2 |
| 2 | +title: Deploying Gaia Hub on Amazon EC2 |
3 | 3 | description: Use a template to deploy a Gaia hub on Amazon EC2
|
4 | 4 | ---
|
5 | 5 |
|
6 | 6 | ## Introduction
|
7 | 7 |
|
8 | 8 | The template provided on this page provides an easy way to deploy a Gaia hub directly to Amazon EC2. You can use this
|
9 |
| -template to deploy your own Gaia hub to your Amazon Web Services account. Amazon EC2 is an affordable and convenient |
10 |
| -cloud computing provider. This template uses Amazon EC2 instance together with an S3 provider for file storage. |
| 9 | +template to deploy your own Gaia hub to your Amazon Web Services (AWS) account. Amazon EC2 is an affordable and |
| 10 | +convenient cloud computing provider. The template provides a one-click deploy for Amazon EC2 with an S3 provider for |
| 11 | +file storage. |
11 | 12 |
|
12 |
| -## Template |
| 13 | +## Prerequisites |
| 14 | + |
| 15 | +This procedure uses Amazon CloudFormation to configure an EC2 cloud compute provider to run the Gaia hub service with |
| 16 | +an S3 provider for file storage. You should have access to an AWS account either through your personal account or |
| 17 | +through a corporate account. This account should have permissions to create resources. |
| 18 | + |
| 19 | +Additionally, you must also own a domain name and be able to update the DNS records associated with that domain name. |
| 20 | +The procedure on this page uses a free domain created on [freenom][], generically the procedure used |
| 21 | +is similar on other domain name providers. |
| 22 | + |
| 23 | +## Launching the template |
| 24 | + |
| 25 | +Use a link in the table to launch the CloudFormation template in the AWS region that you wish to deploy a Gaia hub. |
13 | 26 |
|
14 | 27 | | Template name | Description | Launch |
|
15 | 28 | | ------------------------ | ------------------------------------------------------------- | -------------------------------------------------------------------- |
|
16 |
| -| Gaia Hub EC2 (us-west-2) | Deploys a Gaia hub service on EC2 with an S3 storage provider | [][ec2-us-west-2] | |
| 29 | +| Gaia Hub EC2 (us-east-1) | Deploys a Gaia hub service on EC2 with an S3 storage provider | [][ec2-us-east-1] | |
| 30 | + |
| 31 | +## Task 1: Configure the CloudFormation template |
| 32 | + |
| 33 | +Before launching your Gaia hub, you must configure the template with the appropriate values for your hub and the domain |
| 34 | +it runs on. |
| 35 | + |
| 36 | +1. Launch the template using the **Launch stack** button in the preceding table. |
| 37 | +2. Review the **Prepare template** and **Template source** fields to ensure that they are populated. |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +3. Click **Next**. |
| 42 | +4. Specify configuration details for your Gaia hub: |
| 43 | + |
| 44 | + i. Enter the **Stack name**. This name must be unique within your AWS account. |
| 45 | + |
| 46 | +  |
| 47 | + |
| 48 | + ii. Enter the domain name on which the hub should run in the **DomainName** field. You must own this domain name and |
| 49 | + be able to update the DNS records associated with it. |
| 50 | + |
| 51 | +  |
| 52 | + |
| 53 | + iii. Enter an email address associated with the Gaia hub in the **EmailAddress** field. This should be a valid email |
| 54 | + that you have access to. |
| 55 | + |
| 56 | +  |
| 57 | + |
| 58 | + iv. Enter the name of the S3 bucket to create for data storage in the **GaiaBucketName** field. The name will be |
| 59 | + combined with the stack name to create a unique S3 bucket. |
| 60 | + |
| 61 | +  |
| 62 | + |
| 63 | + v. Select an available **InstanceType** from the drop-down. The default value is `t2.micro`. |
| 64 | + |
| 65 | + vi. In the **KeyName** drop-down, select an [EC2 KeyPair](https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#KeyPairs:) |
| 66 | + to enable SSH access to the EC2 instance. You should download the `.pem` keyfile for this pair from the EC2 console. |
| 67 | + |
| 68 | + For more information see the [EC2 key pair documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#prepare-key-pair). |
| 69 | + |
| 70 | +  |
| 71 | + |
| 72 | + vii. Leave the **SSHLocation** field with the default value of `0.0.0.0/0` to enable SSH access from any IP address. |
| 73 | + If you wish to restrict SSH access to the EC2 instance to a certain IP, you can update this field. |
| 74 | + |
| 75 | + viii. Select a subnet and virtual private cluster (VPC) from the **SubnetId** and **VpcId** drop-downs to designate |
| 76 | + where to deploy the Gaia hub instance. |
| 77 | + |
| 78 | +  |
| 79 | + |
| 80 | +5. Click **Next**. |
| 81 | +6. Configure stack options for your Gaia hub: |
| 82 | + |
| 83 | + i. Enter any key-value pairs you wish to include as tags for your Gaia hub. These are optional and display-only, they |
| 84 | + have no effect on the behavior of the CloudFormation stack. |
| 85 | + |
| 86 | + ii. Select an IAM role for the Gaia hub. This is optional, if you don't specify am IAM role, the container runs |
| 87 | + with the same permissions as your AWS account. |
| 88 | + |
| 89 | +7. Click **Next**. |
| 90 | +8. Review the configuration of your Gaia hub, and make any changes necessary. |
| 91 | +9. At the bottom of the page, select the checkbox to acknowledge that AWS may create IAM resources with custom names. |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | +10. Click **Create stack** to launch your Gaia hub. The AWS console displays the summary of the stack. |
| 96 | + |
| 97 | +## Task 2: Retrieve the public IP of your Gaia hub |
| 98 | + |
| 99 | +Your stack can take several minutes to launch. You can monitor the **Events** tab of your hub to review the current |
| 100 | +progress of the launch. When the launch is complete, the **Outputs** tab displays information about the hub. Select |
| 101 | +the **PublicIP** and copy it to configure your domain name. |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | +## Task 3: Configure a domain name |
| 106 | + |
| 107 | +Connect your domain to the Gaia hub EC2 instance by creating an `A` record for the domain DNS entry, and enter the |
| 108 | +public IP from the previous step. In general, this procedure will be similar depending on your hostname provider. |
| 109 | + |
| 110 | +If you are using a free domain from [freenom], use the following procedure: |
| 111 | + |
| 112 | +1. Log in to your freenom account. |
| 113 | +2. Under **Services** > **My Domains**, click **Manage Domain** next to the domain corresponding to your Gaia hub. |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | +3. Click **Manage Freenom DNS** in the tab bar. |
| 118 | +4. In the **Add Records** table, select `A` from the **Type** drop-down, then paste the public IP of your Gaia hub EC2 |
| 119 | + instance in the **Target** field. |
| 120 | +5. Click **Save Changes** to update the DNS record. |
| 121 | + |
| 122 | +-> It can take up to 15 minutes for your DNS record changes to propagate. In a terminal, use the command |
| 123 | +`dig A +short <yourdomain.co>` to check if the changes have propagated. If the output of this command is the container |
| 124 | +public IP, the changes were successful. |
| 125 | + |
| 126 | +## Accessing your Gaia hub with SSH |
| 127 | + |
| 128 | +To SSH into your Gaia hub EC2 host directly, you must have the keyfile used in container creation. Access the host with |
| 129 | +the following command in your terminal: |
| 130 | + |
| 131 | +```bash |
| 132 | +ssh -i <your keyfile.pem> admin@<public_ip_address> |
| 133 | +``` |
| 134 | + |
| 135 | +## Making changes to your Gaia hub |
| 136 | + |
| 137 | +If you want to make changes to your Gaia hub, there are two options. You can delete the entire CloudFormation stack |
| 138 | +using the **Delete** button in the CloudFormation dashboard. Once you have deleted the stack, you can re-create one and |
| 139 | +modify your DNS to point at the new public IP. |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | +To modify the instance in place, navigate to the [EC2 instances console][] and type the instance name into the |
| 144 | +**Filter instances** field. Select the instance from the search suggestion, then click the instance to select it. |
| 145 | + |
| 146 | +On the **Tags** tab, you can click **Manage tags** to update the relevant key value pairs for the instance. If you make |
| 147 | +changes to these tags, click **Save**, then select **Reboot instance** from the **Instance state** drop-down. Changes |
| 148 | +to the tags don't take effect until the instance is rebooted. |
| 149 | + |
| 150 | + |
17 | 151 |
|
18 |
| -[ec2-us-west-2]: https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/new?stackName=Gaia&templateURL=https://cf-templates-18jq0t04gve7c-us-west-2.s3-us-west-2.amazonaws.com/2021124ByT-cf.yaml |
| 152 | +[ec2-us-east-1]: https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=Gaia&templateURL=https://cf-templates-18jq0t04gve7c-us-east-1.s3.amazonaws.com/cloudformation.yaml |
| 153 | +[freenom]: https://freenom.com |
| 154 | +[ec2 instances console]: https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#Instances |
0 commit comments