Overview
AWS ECS Fargate is a serverless compute engine provided by Amazon Web Services (AWS) that simplifies the deployment and management of containerized applications. It eliminates the need for managing the underlying infrastructure, allowing you to focus on application logic while AWS handles provisioning, scaling, and maintenance of compute resources.
...
Components Required for Running KnowHOW on ECS
Terraform Script -
View file |
---|
name | knowhow-terraform-scripts.zip |
---|
|
Expand |
---|
|
VPC (Virtual Private Cloud): A logically isolated section of the AWS cloud where resources are launched. Configure IP address ranges, subnets, and route tables. Subnets: Subdivisions of a VPC, typically created in different Availability Zones for high availability. Internet Gateway: Enables communication between VPC instances and the internet. Route Table: Defines rules for directing network traffic within the VPC. Route Table Association: Links subnets to route tables to use defined routes.
|
Expand |
---|
|
ECS Cluster: A logical grouping of container instances for managing containers as a single unit. ALB (Application Load Balancer): Distributes incoming application traffic across multiple targets. NLB (Network Load Balancer): Routes TCP/UDP traffic at the transport layer (Layer 4). ALB Listener: Processes connection requests and forwards them to target groups. ALB Listener Rules: Define routing based on conditions like URL paths or hostnames. Target Group: A collection of resources serving traffic together. Security Group: A virtual firewall controlling inbound and outbound traffic.
|
Expand |
---|
|
ECS Task Definition: A blueprint for containers defining parameters like Docker images, CPU/memory requirements, and networking settings. ECS Service: Maintains a specified number of running tasks based on task definitions. CloudWatch: Monitors performance and logs metrics. NFS (Network File System): Provides persistent storage for MongoDB data. IAM Role & Policy: Grants permissions for ECS tasks and services to securely access AWS resources.
|
...
Deploying KnowHOW on ECS Using Terraform Scripts
Expand |
---|
title | Step 1: Infrastructure |
---|
|
Navigate to the infrastructure directory: Code Block |
---|
cd ecs_fargate/1-Infrastructure |
Initialize Terraform: Apply the configuration: Code Block |
---|
terraform apply -auto-approve |
|
Expand |
---|
|
Navigate to the platform directory: Code Block |
---|
cd ../2-Platform |
Replace your SSL certificate ARN and actual IP address in 2-Platform/variable.tf : Initialize and apply Terraform: Code Block |
---|
terraform init
terraform apply -auto-approve |
Info |
---|
Refer to the README.MD file for instructions on uploading the SSL certificate. |
|
Expand |
---|
|
Navigate to the application directory: Code Block |
---|
cd ../3-Application |
Update the terraform.tfvars file with the desired KnowHOW version (e.g., 7.2.0 ). Initialize and apply Terraform: Code Block |
---|
terraform init
terraform apply -auto-approve |
|
...
Using Existing Services with Terraform
To avoid recreating existing resources, comment out the corresponding resource block in the Terraform configuration. Example:
Code Block |
---|
#resource "aws_ecs_cluster" "PSKnowHOW-Cluster" {
# name = var.ecs_cluster_name
#} |
...
Importing Existing Resources
Import existing resources into the Terraform state:
Code Block |
---|
terraform import aws_vpc.example_vpc example-vpc |
...
Using Outputs
Define outputs in output.tf
to share resource information:
Code Block |
---|
output "imported_VPC_id" {
value = aws_vpc.example_vpc.id
} |
...
Summary
Comment existing resource blocks in Terraform.
Use terraform import
to manage existing resources.
Define outputs for sharing resource details.
This approach ensures seamless integration with existing infrastructure, minimizing the risk of unintended changes.