Cloud Infrastructure

Running Smarter in production in the cloud requires some additional configuration and setup. Smarter currently support AWS as its sole cloud infrastructure provider. The project maintains a set of Terraform scripts to fully automate the deployment and management of all AWS infrastructure resources required for normal operation of the Smarter platform.

Official Smarter Terraform Scripts - https://github.com/smarter-sh/smarter-infrastructure.

See the README file in that repository for detailed instructions on how to use Terraform scripts to deploy and manage Smarter infrastructure on AWS. This set of Terraform scripts will store its state remotely in an AWS S3 bucket, and it will also enable state locking using AWS DynamoDB to prevent concurrent modifications to the infrastructure. See smarter-infrastructure/aws/terragrunt.hcl for more details.

Smarter’s Terraform scripts also use Terragrunt, a thin wrapper for Terraform that provides extra tools for working with multiple Terraform modules and managing remote state. It is highly recommended to use Terragrunt when working with the Smarter infrastructure Terraform scripts as this facilitates reuse of the Terraform modules across different environments (e.g., alpha, beta, next, production) and simplifies management of remote state files in S3.

Danger

THERE ARE COSTS ASSOCIATED WITH RUNNING CLOUD INFRASTRUCTURE. Be sure to review the AWS pricing documentation for each of the services that will be created by the Terraform scripts to understand the potential costs involved.

CREATING AND MANAGING CLOUD INFRASTRUCTURE IS MUCH MORE COMPLEX THAN SIMPLY DEPLOYING THE SMARTER APPLICATION ITSELF. It is assumed that the person using these Terraform scripts has a good understanding of AWS services, Terraform, and Terragrunt. If you are not familiar with these technologies, it is highly recommended to seek assistance from someone who is experienced in cloud infrastructure management before attempting to use these scripts.

Usage

To use the Terraform scripts, follow these steps:

  1. Install the AWS CLI on your local machine. Follow the instructions at https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html.

  2. Configure the AWS CLI with your credentials by running:

aws configure
  1. Install Terraform on your local machine. Follow the instructions at https://learn.hashicorp.com/tutorials/terraform/install-cli.

  2. Install Terragrunt on your local machine. Follow the instructions at https://terragrunt.gruntwork.io/docs/getting-started/install/.

  3. Clone the smarter-infrastructure repository to your local machine.

    git clone https://github.com/smarter-sh/smarter-infrastructure.git
    cd smarter-infrastructure/aws/prod
    
  4. Initialize the Terraform working directory by running:

    terragrunt init
    
  5. Review and customize the terragrunt.hcl configuration file to match your specific requirements.

  6. Review the Terraform plan by running:

    terragrunt plan
    
  7. Apply the Terraform configuration to create the necessary AWS resources by running:

    terragrunt apply
    
  8. Follow the prompts to confirm the creation of resources.

  9. Once the process is complete, Terraform will have created all the necessary AWS resources for running Smarter in production.

Resources Created

The Terraform scripts will create the following AWS resources: