Infrastructure as code to deploy a React application to AWS as an Amplify service.
- Install AWS & Terraform CLI
- IAM User with secret access keys (Reccomened by AWS not to use the root user). This will need the
AdministratorAccess-Amplifypermission policy at minimum - Obtain your personal Github PAT
- Use the IAM user via the AWS CLI. To set this, type
aws configureand enter the the Access Key ID (Accessible from IAM->Users->Access Key) and the Access Secret Key (Can be viewed only once when generated). - Create a values.tfvars with the following properties
region = "" # Chosen region
access_token = "" # Github PAT
repository = "" # Url link
app_name = "" # Name of repo
branch_name = "" # Branch to deploy
View changes without actioning
terraform plan -var-file=values.tfvars
Apply changes. Once this completes the application will be viewable in the AWS console
terraform apply -var-file=values.tfvars
Deletes the Amplify app from AWS console.
terraform destroy -var-file=values.tfvars
- Apply works as expected, however this does not kick off a build automatically.