Prerequisite:
- Terraform installed
- AWS CLI installed
- AWS IAM user with administrative access
👉 let install dependency to deploy the application
cd main
terraform init
Note: we need public key and private key for our server so follow below procedure.
cd modules/key/
ssh-keygen.exe
above command ask for key name then give client_key
it will create pair of keys one public and one private. you can give any name you want but then you need to edit the terraform file
edit below file according to your configuration
vim main/backend.tf
add below code in book_shop_app/backend.tf
terraform {
backend "s3" {
bucket = "BUCKET_NAME"
key = "backend/terraform.tfstate"
region = "us-east-1"
dynamodb_table = "dynamoDB_TABLE_NAME"
}
}
create one file with the name of terraform.tfvars
vim main/terraform.tfvars
add below contents into main/terraform.tfvars
file
REGION = ""
PROJECT_NAME = ""
VPC_CIDR = ""
PUB_SUB_1_A_CIDR = ""
PUB_SUB_2_B_CIDR = ""
PRI_SUB_3_A_CIDR = ""
PRI_SUB_4_B_CIDR = ""
PRI_SUB_5_A_CIDR = ""
PRI_SUB_6_B_CIDR = ""
DB_USERNAME = ""
DB_PASSWORD = ""
CERTIFICATE_DOMAIN_NAME = ""
ADDITIONAL_DOMAIN_NAME = ""
Get into project directory
cd main
Type below command to validate the syntax and configuration of your Terraform files
terraform validate
Type below command to see plan of the exection
terraform plan
Type the below command to executes the actions proposed in a terraform plan
terraform apply
type yes
, it will prompt you for permission..