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

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

- Access ECR

- Return to the ECS interface
- Select Monolith-Definition-STACK_NAME

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

-
Choose the operating system, memory amount, and CPU

-
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

-
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

-
Complete creating the new revision

-
In the Monolith-Definition-STACK_NAME console:
- Select Deploy
- Select Run task

- In the Task details section

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

- 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

- Task created successfully

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

- Perform access via browser
http://TASK_PUBLIC_IP_ADDRESS/mysfits

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

- Select the newly created task and select Logs

-
Use AWS CloudWatch to view Log events

- Select a log stream to view detailed logged events


-
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

- If prompted, click the Stop button.

- Task stopped successfully.
