Tutorial / Cram Notes

Deployment methodologies vary by the platform and the type of application or service being deployed. For Amazon Web Services (AWS), there are multiple platforms to deploy applications, including Amazon EC2, Amazon Elastic Container Service (ECS), Amazon Elastic Kubernetes Service (EKS), and AWS Lambda. Each platform has unique deployment strategies that cater to different use cases.

Amazon EC2 Deployment Methodologies

Amazon EC2 (Elastic Compute Cloud) allows users to deploy virtual servers, known as instances. Below are some common deployment methodologies:

  • Blue/Green Deployment:

    • This method reduces downtime and risk by running two identical production environments. Only one is live at a time (Blue – live, Green – standby). After deploying and testing the new version in the Green environment, you can switch traffic to it.
  • Rolling Deployment:

    • Incrementally replace the old version with the new one on the existing fleet of EC2 instances. This can be performed manually or automated with tools like AWS CodeDeploy, which provides control over the pace of deployment.
  • Canary Deployment:

    • A new version is released to a small subset of users before a full rollout. AWS CodeDeploy supports canary deployments, allowing you to monitor the performance before proceeding.

Amazon Elastic Container Service (ECS) Deployment Methodologies

Amazon ECS allows for the orchestration of containerized applications. Deployment strategies here include:

  • Rolling Update:

    • The default strategy where a new version of the application is rolled out across the cluster. The ECS service scheduler replaces the existing tasks with new ones.
  • Blue/Green Deployment (using AWS CodeDeploy):

    • Similar to EC2, you can deploy a new version of your application alongside the old version before rerouting traffic. AWS CodeDeploy manages this process.
  • External Deployment Controllers:

    • External tools like Spinnaker or Jenkins can be integrated with ECS for more complex deployment workflows.

Amazon Elastic Kubernetes Service (EKS) Deployment Methodologies

Amazon EKS manages Kubernetes on AWS. Kubernetes offers several deployment strategies, such as:

  • Rolling Updates:

    • This native Kubernetes feature updates Pods with new ones incrementally.
  • Canary Deployments (using Istio or Flagger):

    • Canary deployments can be implemented using service mesh technologies like Istio or tools like Flagger.
  • Blue/Green Deployments (using Argo Rollouts):

    • You can achieve Blue/Green deployments in EKS by using custom Kubernetes controllers like Argo Rollouts.

AWS Lambda Deployment Methodologies

AWS Lambda is a serverless compute service. Lambda versions and aliases provide flexibility in deployment:

  • Traffic Shifting:

    • Use Lambda aliases to shift traffic between different versions of your Lambda function for a gradual rollout.
  • Canary Deployments:

    • Similar to traffic shifting, you can use AWS CodeDeploy to launch a canary deployment where a small percentage of traffic is sent to the new Lambda version before a full rollout.
  • Blue/Green Deployments:

    • You can accomplish this by using Lambda aliases and weighted routing, where the Blue environment receives a certain percentage of traffic and the Green environment the rest.

Comparison Table

Deployment Type Amazon EC2 Amazon ECS Amazon EKS AWS Lambda
Blue/Green AWS CodeDeploy AWS CodeDeploy Argo Rollouts, AWS CodeDeploy Lambda Aliases
Rolling AWS CodeDeploy Rolling Update Kubernetes Rolling Updates NA
Canary AWS CodeDeploy AWS CodeDeploy, External Istio, Flagger AWS CodeDeploy
Traffic Shifting Not Applicable (N/A) N/A N/A Lambda Aliases

In practice, deploying a new version using AWS services typically involves a combination of the AWS Management Console, AWS CLI, and AWS SDKs. For instance, when using CodeDeploy to deploy an EC2 application, defining an appspec.yml file to specify the deployment steps is crucial. And for EKS deployment, you may create YAML files that define your Kubernetes resources and use kubectl to apply those definitions.

These methodologies aim to minimize downtime, ensure high availability, and allow for a safer rollout of new features and updates. The choice between them usually depends on the specific requirements and infrastructure preferences for the application.

Practice Test with Explanation

Amazon EC2 instances are suitable for serverless architectures.

  • True
  • False

Answer: False

Explanation: Amazon EC2 instances are not serverless; they are virtual servers in the cloud that you manage. AWS Lambda is an example of a serverless architecture where you run code without provisioning or managing servers.

AWS Lambda functions scale automatically in response to the incoming request volume.

  • True
  • False

Answer: True

Explanation: AWS Lambda automatically scales the application by running code in response to each trigger. The service handles the heavy lifting of managing the infrastructure.

Which AWS service is a fully managed container orchestration service?

  • Amazon EC2
  • Amazon Elastic Container Service (ECS)
  • Amazon Elastic Kubernetes Service (EKS)
  • AWS Lambda

Answer: Amazon Elastic Kubernetes Service (EKS)

Explanation: Amazon EKS is a fully managed Kubernetes service. Amazon ECS is also a fully managed container orchestration service, but it is not exclusively for Kubernetes—it supports Docker containers natively.

Amazon EC2 Auto Scaling helps with:

  • Horizontal scaling
  • Vertical scaling
  • Both horizontal and vertical scaling
  • Neither horizontal nor vertical scaling

Answer: Horizontal scaling

Explanation: Amazon EC2 Auto Scaling helps automatically increase the number of Amazon EC2 instances during demand spikes to maintain performance and decrease capacity during lulls to reduce costs. This is known as horizontal scaling (scaling out/in).

AWS Lambda supports which of the following deployment models?

  • Blue/Green deployment
  • Rolling deployment
  • All-at-once deployment
  • Lambda does not support deployments

Answer: Blue/Green deployment

Explanation: AWS Lambda supports blue/green deployment by leveraging alias and versioning features of Lambda functions, allowing traffic shifting between different versions of a function.

To deploy a Docker container on AWS, which services can be used? (Select TWO)

  • Amazon EKS
  • Amazon S3
  • Amazon ECS
  • AWS Lambda
  • Amazon EC2

Answer: Amazon EKS, Amazon ECS

Explanation: Amazon EKS is a managed Kubernetes service, and Amazon ECS is a highly scalable, fast, container management service that supports Docker containers.

What is the main purpose of AWS Fargate?

  • To provide serverless compute for containers
  • To manage Kubernetes clusters
  • To facilitate batch computing jobs
  • To run serverless functions like AWS Lambda

Answer: To provide serverless compute for containers

Explanation: AWS Fargate is a compute engine for Amazon ECS and EKS that allows you to run containers without having to manage servers or clusters.

With Amazon EKS, you are responsible for patching the master K8s nodes.

  • True
  • False

Answer: False

Explanation: In Amazon EKS, the master nodes are managed and patched by AWS, relieving the users from the operational overhead of managing the Kubernetes control plane.

Which one of the following services provides the easiest way to deploy and manage microservices?

  • Amazon EC2
  • Amazon EKS
  • AWS Lambda
  • Amazon ECS

Answer: Amazon ECS

Explanation: Amazon ECS is a container orchestration service that is deeply integrated with AWS services, making it easier to deploy, manage, and scale Docker containerized microservices.

Amazon Elastic Container Registry (ECR) is primarily used for:

  • Storing and retrieving container images
  • Monitoring container performance
  • Hosting container applications
  • Orchestrating container deployment

Answer: Storing and retrieving container images

Explanation: Amazon ECR is a fully-managed Docker container registry that makes it easy for developers to store, manage, and deploy Docker container images.

In Amazon EC2, which feature allows you to deploy an application across multiple Availability Zones?

  • Auto Scaling groups
  • Elastic Load Balancing
  • Amazon Machine Images (AMIs)
  • EC2 Fleet

Answer: Auto Scaling groups

Explanation: Auto Scaling groups can span multiple Availability Zones, and when combined with Elastic Load Balancing, they can distribute the incoming traffic across the instances in these zones for high availability.

Can AWS CodeDeploy be used to deploy applications to AWS Lambda?

  • Yes
  • No

Answer: No

Explanation: AWS CodeDeploy is a service that automates code deployments to various compute services such as Amazon EC2 instances, on-premises instances, and Amazon ECS services, but it does not support deployments to AWS Lambda. Deployments to AWS Lambda are handled through different mechanisms like AWS CLI, AWS Lambda console, AWS SDKs, or infrastructure as code (IaC) services like AWS CloudFormation, AWS SAM (Serverless Application Model), or Terraform.

Interview Questions

What are the key differences between Blue/Green and Canary deployments on AWS, and which AWS service can facilitate these deployment strategies?

Blue/Green deployments involve running two identical environments, where one (Blue) is the current production environment and the other (Green) is the new version to be deployed. Once the Green environment is ready and tested, traffic is switched over from Blue to Green. On the other hand, Canary deployments roll out the changes to a small subset of users before rolling it out to everyone. This strategy allows for monitoring the impact and mitigating any issues. AWS services such as Amazon ECS, Amazon EKS, and AWS Elastic Beanstalk support Blue/Green deployments directly or through integration with AWS CodeDeploy, which enables both Blue/Green and Canary deployments.

How would you deploy a serverless application on AWS, and what are some considerations you must take into account regarding deployment methodologies?

To deploy a serverless application on AWS, you would typically use AWS Lambda and the AWS Serverless Application Model (SAM) as it streamlines the deployment process. Considerations would include choosing the right deployment strategy like All-at-Once, Canary or Linear, managing deployment packages, handling Lambda versioning and aliases, setting up the required IAM roles, using deployment policies, integrating with CI/CD pipelines, and testing thoroughly before deployment.

Describe an effective strategy for rolling back a failed deployment on Amazon ECS.

AWS CodeDeploy, integrated with Amazon ECS, offers automatic rollbacks in case of a failed deployment. An effective rollback strategy would involve setting up alarms and rollback triggers based on CloudWatch alarms or other monitoring tools. If a deployment does not meet specific criteria, AWS CodeDeploy can automatically roll back to the last known good version of the container.

Can you explain the concept of infrastructure as code and how it applies to deployments on AWS?

Infrastructure as Code (IaC) is the process of managing infrastructure (networks, virtual machines, load balancers, connection topology, etc.) in a descriptive model, using code rather than manual processes. AWS offers services like AWS CloudFormation and the AWS CDK (Cloud Development Kit) to implement IaC, enabling consistent and repeatable deployments by scripting the entire infrastructure setup.

What are the benefits of using Amazon Elastic Kubernetes Service (Amazon EKS) for application deployment, and how does it compare to deploying directly on Amazon EC2 instances?

Amazon EKS provides a managed Kubernetes service, which simplifies the setup, scalability, and maintenance of a Kubernetes cluster. It automates tasks such as patching, node provisioning, and updates. EKS provides higher abstraction compared to EC2, which requires manual installation and management of the Kubernetes platform. Moreover, EKS integrates with AWS services for logging, monitoring, security, and CI/CD, providing a more comprehensive environment for deployment.

How would you automate the deployment of microservices on AWS, ensuring that they are scalable and fault-tolerant?

Automating the deployment of microservices can be done using AWS CodePipeline in conjunction with AWS CloudFormation or AWS CDK for IaC. Amazon ECS with Fargate or Amazon EKS can be used as the orchestration service, which supports auto-scaling and self-healing out-of-the-box, ensuring that the microservices are scalable and fault-tolerant. Additionally, you can use Amazon Route 53 for service discovery and failover to enhance fault tolerance.

What are the best practices for managing secrets and sensitive information during the deployment process on AWS?

Best practices for managing secrets and sensitive information during deployments include using AWS Secrets Manager or AWS Systems Manager Parameter Store to secure and manage secrets. It’s important to avoid hardcoding secrets in the application code or deployment scripts, granting minimum necessary permissions using IAM roles, and auditing access to secrets regularly using IAM Access Analyzer and CloudTrail.

How do you ensure zero-downtime deployments when using AWS services for your application?

Zero-downtime deployments can be ensured by implementing strategies such as Blue/Green, Rolling Updates, or Canary releases. Services like AWS Elastic Load Balancing can distribute traffic, while AWS Auto Scaling can add or replace instances with no impact on availability. It is crucial to incorporate health checks and appropriate rollback mechanisms in case of deployment failures.

Describe how you would use AWS CodeDeploy to automate deployments across multiple development environments.

Using AWS CodeDeploy and its deployment groups, you can automate code deployments to various environments such as development, testing, staging, and production. By creating separate deployment groups for each environment and defining different deployment configurations, you can utilize a consistent automated deployment process and promote your code from one stage to the next while maintaining fine-grained control over how and when changes are deployed.

How does AWS CodeStar facilitate the integration of deployment methodologies into a CI/CD pipeline on AWS?

AWS CodeStar provides a unified user interface to manage software development activities and integrates with AWS CodeCommit, AWS CodeBuild, AWS CodeDeploy, and AWS CloudFormation. It simplifies the creation of a complete CI/CD pipeline. With CodeStar, you can easily define how your application will be built, tested, and deployed on different AWS services, thereby streamlining the adoption of various deployment methodologies. It also provides project templates to support deployment best practices.

What considerations should be made when implementing automatic scaling as part of your deployment strategy on AWS?

When implementing auto-scaling, considerations include defining appropriate scaling policies based on metrics such as CPU utilization, memory usage, or custom metrics. You should also consider the warm-up time for new instances to be fully operational, cooldown periods to prevent thrashing, and using predictive scaling to automatically schedule the right number of EC2 instances based on predicted demand.

How can AWS CloudFormation assist in the deployment of applications across multiple AWS regions?

AWS CloudFormation allows you to define your infrastructure and applications in a declarative template, which can be used to reliably replicate the environment across multiple AWS regions. With the help of stack sets, you can create, update, or delete stacks across multiple accounts and regions with a single operation, ensuring consistency and saving time when deploying applications globally.

0 0 votes
Article Rating
Subscribe
Notify of
guest
25 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Najma Tvenge
7 months ago

Great post! Very informative about AWS deployment methodologies.

Andy Curtis
6 months ago

Can someone explain the differences between deploying on Amazon ECS and Amazon EKS?

Gerdi Oehlers
6 months ago

Deploying with Lambda seems the easiest. No server management!

Phoebe Campbell
7 months ago

I find EKS more versatile when it comes to complex microservices architectures.

Monica Hall
7 months ago

Can anyone share their experience with cost management between EC2 and ECS?

Leyla Denis
6 months ago

Does Amazon EKS support Windows containers?

Hazel Jackson
6 months ago

Thanks for the post!

Nurdan Abanuz
6 months ago

Can someone highlight the best CI/CD practices for ECS?

25
0
Would love your thoughts, please comment.x
()
x