This section will introduction you to create/destroy the infrastructure of this workshop by using Terraform
Download terraform by this link. After that, verify your terraform cli with:
terraform --version
Install AWS CLI at this link. Then verify it with
aws --version
Using this document to setup AWS Credentials to our AWS CLI with this link
Install SAM CLI for building lambda functions stage: link
sam --version
Install NVM at this link and run following command to install nodejs and esbuild link
# Validate nvm
nvm -v
# Install nodejs with latest version (Listing version with `nvm ls` or specified version `nvm install 20 && nvm use 20`)
nvm install node && nvm use node
# Validate nodejs is installed
node -v
# Install esbuild global
npm install -g esbuild
Region is us-east-1
.
This is our terraform source code tree, i split each service into modules for use later.
.
├── README.md
├── main.tf
├── modules
│ ├── amazon-bedrock
│ │ ├── main.tf
│ │ ├── outputs.tf
│ │ ├── providers.tf
│ │ └── variables.tf
│ ├── cloudwatch
│ │ ├── main.tf
│ │ ├── outputs.tf
│ │ └── variables.tf
│ ├── dynamodb
│ │ ├── main.tf
│ │ ├── outputs.tf
│ │ └── variables.tf
│ ├── iam-role
│ │ ├── main.tf
│ │ ├── outputs.tf
│ │ └── variables.tf
│ ├── lambdas
│ │ ├── main.tf
│ │ ├── outputs.tf
│ │ └── variables.tf
│ ├── s3
│ │ ├── main.tf
│ │ ├── outputs.tf
│ │ └── variables.tf
│ ├── ses
│ │ ├── main.tf
│ │ ├── outputs.tf
│ │ └── variables.tf
│ └── sqs
│ ├── main.tf
│ ├── outputs.tf
│ └── variables.tf
├── outputs.tf
├── providers.tf
├── terraform.tfvars.example (You must copy and edit this file to `terraform.tfvars`)
└── variables.tf
First, you must clone or download my source code at this link. After that you would copy folder resource
to other directory and then you can start creating your infrastructure.
Next, in terraform
directory we need copy the file terraform.tfvars.example
to terraform.tfvars
.
Go to terraform
directory
cd terraform
Init Provider
terraform init
Check current state and variables
terraform plan
If not errors occurs, we can go next.
terraform apply -auto-approve
After this, you must go to SES dashboard to setup Easy DKIM in the step 4 Setting Domain and Email identity. Now, you can go to testing your result.
terraform destroy -auto-approve