This tutorial guides you through deploying an environment with specific resources in AWS infrastructure.
Prerequisites:
An AWS account with appropriate permissions.
Basic knowledge of AWS service Cloudformation
Basic understanding of AWS services (RDS, Secrets Manager, Amplify, CodeBuild)
Variables Naming Convention
Replace <environment> in the resource names with the environment name (e.g., chile-dev, arg-staging, col-prod)
Create Deployment Role
Cloudformation
Go to the AWS CloudFormation Console.
Click on the Create stack button, then select With new resources (standard).
Under Specify template, choose Upload a template file.
Click Choose file and select your CloudFormation template file (e.g., stack.yaml).
Use this file for this step https://github.com/Lend2B/lend2b-infrastructure/blob/main/stack.yaml
Enter a Stack name.
Under Parameters, provide the necessary parameter values as required by your template:
Environment:DEVRegion:us-east-2Mode:mainPrefix:chile-devCreateVPC:falseCaptchaAPIKey:<google-captcha-api-key>
Review the configuration and click Create stack.
RDS
Go to the RDS console and create a new DB instance
Select Aurora MySQL complatible
Set the DB instance identifier: lending-database-<environment>
Manage with Secret Manager
Choose Serverless V2
Capacity range 0.5-1 (Dev and testing environment)
Activate MultiAZ mode
Choose a VPC <environment>-vpc
Select a security group named DatabaseSG
Add a tag with the key STAGE and the value as <environment>.
Secret Manager
In the Secret Manager console, Store a new a secret:
Secret name: <environment>/lend2b/db
Secret type: "Other type of secret"
Secret value type: "Key/value"
Define key-value pairs for username, password, engine, host, port, dbname, and dbClusterIdentifier with the values of the RDS database credentials
{
"engine":"mysql",
"port":"3306",
"host":"",
"username":"",
"password":"",
"dbname":"",
"dbClusterIdentifier":""
}
Tag with STAGE key and <environment> value
Amplify
Go to the Amplify Apps Console
Click on the View App button in the <environment>-lend2b-app name app.
Click Start Migration button and then Configure GitHub App
Authorize GitHub App and click in Next button and Complete installation button
Open the app and click in Run Job button.
CodeBuild
Go to the CodeBuild Console
Open the lend2b-codebuild-<environment> project
Click in Start Build button.
Outputs
Frontend
https://<environment>.lend2b.com
API REST
https://<environment>-api.lend2b.com
Test API REST
https://<environment>-api.lend2b.com/health