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 monolith

    • Go to ECS
    • Select Task definitions
    • Find the Task definition named Monolith-Definition-STACK_NAME

    Deploy the container using AWS Fargate

  2. Go to ECR

    • Copy Image URI

    Deploy the container using AWS Fargate

  3. Back to interface ECS

    • Select Monolith-Definition-STACK_NAME

    Deploy the container using AWS Fargate

  4. In the interface Monolith-Definition-STACK_NAME revision 1. We will create a new revision.

    • Select Create new revision

    Deploy the container using AWS Fargate

  5. Configure the OS and amount of CPU and memory

    Deploy the container using AWS Fargate

  6. Configure Container

    • Name, enter the 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

  7. Configure Log collection

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

    Deploy the container using AWS Fargate

  8. Finish creating a new revision

    Deploy the container using AWS Fargate

  9. In the Monolith-Definition-STACK_NAME console UI:

    • Select Deploy
    • Select Run task

    Deploy the container using AWS Fargate

  10. In the Deploy interface

    • Environment, select Existing cluster, select Cluster-STACK_NAME
    • Select Launch type
    • In Launch type, select FARGATE
    • Platform version select LATEST

    Deploy the container using AWS Fargate

  11. In the Deployment configuration section

    • Select Task
    • Desired choose 1

    Deploy the container using AWS Fargate

  12. Configure Networking

    • VPC, select Mysfits-VPC-STACK_NAME
    • Subnets select Mysfits-PublicOne-STACK_NAME
    • Select Security Group, Select Use an existing security group
    • Security group name, choose default but configure inbound port 80
    • Auto-assign public IP - “ENABLED”
    • Select Deploy

    Deploy the container using AWS Fargate

  13. Create task successfully

    Deploy the container using AWS Fargate

  14. Select the task you just created and select Networking.

    • Purpose of using Public IP to use curl command to check by making GET request.
    • When using Fargate initialization, each task gets its own ENI and Public IP and Private IP.

    Deploy the container using AWS Fargate

  15. Make a browser access

    http://TASK_PUBLIC_IP_ADDRESS/mysfits
    

    Deploy the container using AWS Fargate

  16. Execute the curl command on the CLI of your IDE

    curl http://TASK_PUBLIC_IP_ADDRESS/mysfits
    

    Deploy the container using AWS Fargate

  17. Select the task you just created and select Logs

    Deploy the container using AWS Fargate

  18. Using AWS CloudWatch to View Log events

    • Open the CloudWatch Console

    • Select monolith log group (STACK_NAME-MythicalMonolithLogGroup-XXX)

    Deploy the container using AWS Fargate

    • Choose a log stream to see the detailed event logs

    Deploy the container using AWS Fargate

    Deploy the container using AWS Fargate

  19. After running the curl (step 15) command successfully, we can delete the task

    • Select Task
    • Select Monolith-Definition-STACK_NAME revision 2.
    • Select Stop
    • Select Stop selected

    Deploy the container using AWS Fargate

  20. If asked, type Stop to verify and click on Stop

    Deploy the container using AWS Fargate

  21. Delete task successfully.

    Deploy the container using AWS Fargate

  22. Delete the HTTP port 80 rule you have created for the default Security group of the VPC in this lab’s stack.

    Deploy the container using AWS Fargate