Installation - AWS ECS

Installation - AWS ECS

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 -

  • 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.

  • 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.

  • 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

  1. Navigate to the infrastructure directory:

    cd ecs_fargate/1-Infrastructure
  2. Initialize Terraform:

    terraform init
  3. Apply the configuration:

    terraform apply -auto-approve
  1. Navigate to the platform directory:

    cd ../2-Platform
  2. Replace your SSL certificate ARN and actual IP address in 2-Platform/variable.tf:

    • Line 122: Update SSL_certificate_arn.

    • Line 118: Update with your IP address.

  3. Initialize and apply Terraform:

    terraform init terraform apply -auto-approve

Refer to the README.MD file for instructions on uploading the SSL certificate.

  1. Navigate to the application directory:

    cd ../3-Application
  2. Update the terraform.tfvars file with the desired KnowHOW version (e.g., 7.2.0).

  3. Initialize and apply Terraform:

    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:

#resource "aws_ecs_cluster" "PSKnowHOW-Cluster" { # name = var.ecs_cluster_name #}

Import existing resources into the Terraform state:

terraform import aws_vpc.example_vpc example-vpc

Define outputs in output.tf to share resource information:

output "imported_VPC_id" { value = aws_vpc.example_vpc.id }

 

 

© 2022 Publicis Sapient. All rights reserved.