Cloudfront can be simply defined as a CDN (Content Delivery Network), caching your static assets in a datacenter nearer to your viewers. But Cloudfront is a lot more complex and versatile than this simple definition. Cloudfront is a “pull” CDN, which means that you don’t push your content to the CDN. The content is pulled into the CDN Edge from the origin at the first request of any piece of content.
In addition to the traditional pull and cache usage, Cloudfront can also be used as:
A Networking Router
A Web Server
An Application Server
Why is using a CDN relevant?
The main reason is to improve the speed of delivery of static content. By caching the content on the CDN edge, you not only reduce the download time from a few seconds to a few milliseconds, but you also reduce the load and amount of requests on your backend (Network, IO, CPU, Memory, …).
Static content can be defined as content not changing between two identical requests done in the same time frame.
Edges, Mid-Tier Caches, and Origins
Cloudfront isn’t “just” some servers in datacenters around the world. The service is a layered network of Edge Locations and Regional Edge Caches (or Mid-Tier Caches).
Edge Locations are distributed around the globe with more than 400 points of presence in over 90 cities across 48 countries. Each Edge Location is connected to one of the 13 Regional Edge Caches.
Regional Edge Caches are transparent to you and your visitors, you can’t configure them or access them directly. Your visitors will interact with the nearest Edge Location, which will connect to the attached Regional Edge Cache and finally to your origin. Therefore, in this article, we will refer to Cloudfront as the combination of Edge Locations and Region Edge Caches.
What Have We Learned?
Cloudfront is more than just a simple “pull-cache-serve” service
You improve delivery speed to your visitors
You can increase resilience by always using a healthy backend
You improve overall speed to your backend by leveraging AWS’s backbone
You can modify any request to tailor the response to your visitor’s device or region
You don’t always need a backend
You protect your backend by reducing the number of calls reaching it
In this article, we will take a look at a use-case that represents how to deploy a Serverless Containerized NodeJs Application on Amazon ECS Fargate with AWS Copilot.
We will look at both the use case of AWS Copilot normal deploy and AWS CI/CD pipeline-based deployment workflow for serverless containerized applications.
Above AWS Architecture Diagram showing how AWS Copilot CLI is used to deploy Serverless Containerized Application on Amazon ECS Fargate both the way normal and CI/CD pipeline workflow-based deployment.
What is Amazon ECS?
Amazon ECS is a fully managed container orchestration service that makes it easy for you to deploy, manage, and scale containerized applications. 
What is AWS Fargate?
AWS Fargate is a serverless, pay-as-you-go compute engine that lets you focus on building applications without managing servers. AWS Fargate is compatible with both Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS). 
Recently AWS announced that AWS Fargate now delivers faster scaling of applications. Now AWS Fargate enables customers to scale applications faster, improving performance and reducing wait time. AWS has made several improvements over the last year that enable you to scale applications up to 16X faster, making it easier to build and run applications at a larger scale on Fargate, along with that AWS Fargate increases task launch rates.
What is AWS Copilot?
The AWS Copilot CLI is a tool for developers to build, release, and operate production-ready containerized applications on Amazon ECS, AWS Fargate and AWS App Runner. From getting started, pushing to staging, and releasing to production, Copilot can help manage the entire lifecycle of your application development. 
AWS Copilot helps customers focus on building their applications rather than setting up their infrastructure. With one command, AWS Copilot will provision all the infrastructure customers need to run production-ready containerized services on Amazon ECS and AWS Fargate. 
AWS Copilot will create ECS clusters, tasks, services for Fargate launch types along with that also create load balancers, VPC, ECR registries, and more.
AWS Copilot Concepts
Main three concepts: Applications, Environments, Services 
Application - Collection of services and environmentsEnvironment - Deployment environment test/staging/productionService - Service is code/application runs in the container
AWS Copilot FeaturesDevelop - Quick Setup infrastructure for your containerized application
Release - Easily Setup CI/CD pipeline to automatically deploy your containerized application
After git push to origin, you will see project files into AWS CodeCommit Repository
AWS CI/CD Pipeline Workflow with AWS Copilot
Initialize copilot pipeline
copilot pipeline init
Commit and push the buildspec.yml, pipeline.yml, and .workspace files of your copilot directory to your repository.
Run copilot pipeline deploy to create your pipeline
Copilot pipeline deploy will auto-create AWS CodePipeline CI/CD workflow along with AWS CodeBuild project, Relevant IAM Roles, and more that help to Deploy Serverless Containerized NodeJs Application on Amazon ECS Fargate based on git commit and push triggers on specific git branch.
AWS CodePipeline Source Step
Pipeline source step auto using that same AWS CodeCommit repository which we created and added as remote for project in which initialize copilot pipeline.
AWS CodePipeline Build Step
Copilot pipeline deploy auto created new Build Project and used same as part of this CI/CD Pipeline.
During running the CI/CD pipeline the first time, at the Build Stage, it was failed.
Resolved this by updating the Build Project IAM Role Permissions policies by attaching this additional permission: AmazonEC2ContainerRegistryFullAccess
AWS CodePipeline Deploy Step
Copilot pipeline using AWS CloudFormation for deployment steps.
After the AWS Copilot CI/CD pipeline is created, As soon as the developer commits and pushes changes to a specific branch it will auto-trigger the relevant deployment pipeline to the auto-deploy container application.
Remove Copilot Application
copilot app delete
This will help you to clean up your resources created before within the application.
Amazon ECS with Fargate allows you to run Serverless Containers. AWS Copilot CLI is a great tool for easily launching and managing containerized applications on AWS.
AWS Copilot supports quick develop operations for Containerized Amazon ECS applications, environments, services, jobs, tasks through commands, which also allows for a quick release process using deploy & pipeline commands to quicken up the CI/CD workflow for containers. The scope of this article covers the basic features of AWS Copilot CLI with Amazon ECS Fargate, but there is always more to learn since they have more supported features. That being said, you should be able to easily explore those features after reading this article.