Deploy the container using AWS Fargate

Deploy the container using AWS Fargate

Deploy the container using AWS Fargate

  1. First, we will create Task definitions to run the monolith
  • Access ECS
  • Select Task definitions
  • Find the Task definition named Monolith-Definition-STACK_NAME

Deploy the container using AWS Fargate

  1. Access ECR
  • Copy the Image URI

Deploy the container using AWS Fargate

  1. Return to the ECS interface
  • Select Monolith-Definition-STACK_NAME

Deploy the container using AWS Fargate

  1. In the Monolith-Definition-STACK_NAME revision 1 interface, we will create a new revision.
  • Select Create new revision

Deploy the container using AWS Fargate

  1. Choose the operating system, memory amount, and CPU

    Deploy the container using AWS Fargate

  2. Proceed to configure the Container

    • Name, enter a service name of your choice (In the lab, enter monolith-service)
    • Paste the copied Image URI into Image URI

    Deploy the container using AWS Fargate

  3. Configure Log collection

    • Find the log group name of the lab in the CloudFormation stack, copy the physical ID, and paste it into the value of the awslogs-group key

    Deploy the container using AWS Fargate Deploy the container using AWS Fargate

  4. Complete creating the new revision

    Deploy the container using AWS Fargate

  5. In the Monolith-Definition-STACK_NAME console:

  • Select Deploy
  • Select Run task

Deploy the container using AWS Fargate

  1. In the Task details section
  • For Desired select 1

Deploy the container using AWS Fargate

  1. In the Environment interface
  • For Existing cluster, select Cluster-STACK_NAME
  • Select Launch type
  • Under Launch type, select FARGATE
  • For Platform version, select LATEST

Deploy the container using AWS Fargate

  1. Proceed with network configuration in the Networking section
  • For VPC, select Mysfits-VPC-STACK_NAME
  • For Subnets, select Mysfits-PublicOne-STACK_NAME
  • For Security Group, select Use an existing security group
  • For Security group name, select default but you must configure inbound on port 80
  • Auto-assign public IP - “ENABLED”
  • Select Deploy

Deploy the container using AWS Fargate

  1. Task created successfully

Deploy the container using AWS Fargate

  1. Select the newly created task and scroll down to find the Public IP.
  • The purpose is to use the Public IP with the curl command to test by making a GET request.
  • When using the Fargate launch type, each task will receive its own ENI, Public IP, and Private IP.

Deploy the container using AWS Fargate

  1. Perform access via browser
http://TASK_PUBLIC_IP_ADDRESS/mysfits

Deploy the container using AWS Fargate

  1. Execute the curl command on the IDE command-line interface
curl http://TASK_PUBLIC_IP_ADDRESS/mysfits

Deploy the container using AWS Fargate

  1. Select the newly created task and select Logs

Deploy the container using AWS Fargate

  1. Use AWS CloudWatch to view Log events

    • Open the CloudWatch Console

    • Select monolith log (STACK_NAME-MythicalMonolithLogGroup-XXX)

    Deploy the container using AWS Fargate

    • Select a log stream to view detailed logged events

    Deploy the container using AWS Fargate

    Deploy the container using AWS Fargate

  2. After successfully running the curl command, we can stop the task

  • Select Task
  • Select Monolith-Definition-STACK_NAME revision 2 (the image shows 3 because a previous creation failed causing a revision increase; if done correctly, it will be revision 2).
  • Select Stop
  • Select Stop selected

Deploy the container using AWS Fargate

  1. If prompted, click the Stop button.

Deploy the container using AWS Fargate

  1. Task stopped successfully.

Deploy the container using AWS Fargate