Deploy to AWS Cloud

Congratulations! You are now in the last step of App2container process.

app2container-intro

At this stage:

  • Your application container image is already moved into ECR (Elastic Container Registry) and ECS Task definition is created and registered.
  • App2container created the Master Cloudformation template for you to automatically deploy and configure all required resources in Cloud.

In this section, you will launch your Cloudformation template and review the deployment process in AWS console.

  1. In your Worker Machine, run suggested command from “app2container generate app-deployment” output.

    aws cloudformation deploy --template-file C:\Users\Administrator\AppData\Local\app2container\<net-app-id>\EcsDeployment\ecs-master.yml --capabilities CAPABILITY_NAMED_IAM --stack-name a2c-<net-app-id>-ECS
    
    • When you run this command, it will create a Cloudformation stack named as “a2c-<net-app-id>-ECS”.
    The process will take few mins. Go back to AWS Console to review the background activities during the deployment.
    
  2. In AWS Console, Go to “CloudFormation” from services and Click “Stacks”.

    • You will see that a stack has been created with name “a2c-<net-app-id>-ECS”.
    • Notice Nested stacks are triggered by main stack for each deployment. E.g. A separate stacks for ALB (Application LoadBalancer) and ECS Clusters.
    • You can see the triggered events under “events” tab for each stack. deploy-cloudformation-1
  3. After ALB stack completed and ClusterStack triggered in CloudFormation, Navigate to ECS Service.

    • Click to “Clusters” on the left pane.
    • You will see new ECS Cluster is being created.
    • Click to “Cluster” Name as highlighted in below screen.

      Note that your container is going to be deployed into EC2 instance. This has been selected in deployment.json file in extract and containerize steps. You can change it to “FARGATE”, if you dont want to control and manage underlying infrastructure and focus on your containerized workloads.

      deploy-cloudformation-1

AWS FARGATE is a serverless compute engine for containers. With FARGATE, you don’t need to provision and manage servers and you only pay for the resources required to run your containers.

  1. Navigate to EC2 Service and locate the new Instance is being launched automatically. This instance is going to host your container and will be managed by Elastic Container Service (ECS). deploy-cloudformation-1
  2. After the Cluster is created. Under Services tab, you should see your application is deployed and status is “ACTIVE”
    • You can see the “Desired Tasks” and “Running Tasks” and Launch type are defined by App2container.
    • Notice that Launch type is EC2 for this deployment. deploy-cloudformation-2
  3. Click Tasks tab. Here you can see that Task has been created and running.
    • Click the Task Name to see its details. deploy-cloudformation-2
  4. When you are inside the Task, review the Task configurations.
    • Under Load Balancing section, you will see that Target Group has automatically been created for your container.
    • Click Target Group.

      Notice that , VPC, subnet and Security Groups are also defined. You can update those based on your environment requirements.

      deploy-cloudformation-2
  5. Inside the Target Groups, Review the Target Group configuration
    • Target Groups are used to route requests to one or more registered targets. App2container creates Target Groups and registers it with your containers and Loadbalancer.
    • Click LoadBalancer deploy-cloudformation-2
  6. When you are in Loadbalancers, Review the Loadbalancer configurations for your application.
    • Copy the Public DNS Name and paste it in your browser. deploy-cloudformation-2

Congragulations

  1. Congragulations!! You have containerized your application and deployed it into Amazon ECS. deploy-cloudformation-2
  2. Go to CloudFormation Service and notice the multiple stacks are created by App2container and all the required resources for your containerized application are automatically created for you. deploy-cloudformation-2
  3. Go to your Worker Machine Console, You should see the below output stating that your application stack is created successfully! deploy-cloudformation-2