Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand AWS's automated deployment tool codedeploy overview and main components

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces how to understand AWS's automatic deployment tool codedeploy overview and main components, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Codedeploy Overview:

Codedeploy is an automatic deployment service on aws, which can automatically deploy applications to EC2 instances, local instances (any online or offline machine), non-instance lamda functions, and ECS.

Applications that can be deployed include: code, serverless lamda functions, web and configuration, executables, packages, scripts, multimedia files.

Can be deployed to one or thousands of instances.

CodeDeploy provides two deployment type options:

1) in-place deployment: stop the application on each instance of the deployment group, install the latest application revision, and start and verify the new version of the application. You can use the load balancer to unregister each instance during deployment and then return to service after deployment. Only deployments using the EC2 / On-Premises computing platform can use in-place deployment.

How it works: create deployable content, add application specification files (AppSpec file: defines the deployment operations performed by CodeDeploy), bundle the deployable content and AppSpec files into an archive file, and then upload it to S3 or github, which is called the application revision-- > tell codedeploy where the new code or deployment is, and codedeploy calls a set of EC2-- > each EC2 instance on EC2 polls codedeploy Determine where to get the new content and time-- > the CodeDeploy agent on each instance extracts the new code from S3 or GitHub and deploys the content to the instance using the instructions in the AppSpec file.

2) Blue-green deployment: blue / green deployment reroutes traffic from the original environment of the application to the alternative environment, depending on the computing platform of the codedeploy application.

AWS Lambda: traffic is transferred from one version of the Lambda function to a new version of the same Lambda function.

Amazon ECS: traffic is transferred from a task set in an Amazon ECS service to an updated replacement task set in the same Amazon ECS service.

EC2/ local: traffic is transferred from a set of instances in the original environment to a set of replacement instances.

All AWS Lambda and Amazon ECS deployments are blue / green. EC2/ local deployment can be in-place deployment or blue / green deployment. Advantages of blue-green deployment over in-place deployment:

1) applications can be installed and tested in a new replacement environment, and can be applied to a production environment only by rerouting traffic at deployment time

2) if it is an EC2 or a local instance, switching back to the latest version of the program will be faster and more reliable. This is because as long as the original instance is not terminated, traffic can be routed back to the original instance, while in-place deployment, the previous version of the application must be redeployed to roll back

3) if the production environment uses EC2 or local instances, the new instance is preset for the blue-green deployment, and the new instance is the latest server configuration, which can avoid the problems of the production instance running for a long time

4) if you are using the lambda computing platform, you need to control how traffic is transferred from the original version of the lambda function to the new version of the lambda function.

Example: deploy blue and green on EC2 or local instance:

Note (blue-green deployment must use EC2 instances of AWS, not local instances); if using EC2 or local computing platform, there must be one or more EC2 instances with identified EC2 tags or EC2 Auto Scaling groups (these instances must meet: each EC2 instance must be attached with the correct IAM instance configuration file, and the codedeploy agent must be installed and run on each instance) Typically, you also have an application revision that runs on an instance in the original environment, but this is not necessary for blue / green deployments.

When creating a deployment group that uses blue and green deployment, you can choose how to specify the replacement environment: {

Copy existing Amazon EC2 Auto Scaling groups: in a blue-green deployment, codedeploy will create an instance for the replacement environment during deployment, and CodeDeploy will use the specified Amazon EC2 Auto Scaling group as a template for the replacement environment, including the same number of running instances and many other configuration options.

Manually select an instance: use the Amazon EC2 instance tag or Amazon EC2 Auto Scaling group name to specify the instance to be counted as an alternative, and you do not need to specify an instance of the replacement environment before deployment.

Mode of operation:

1) there are already some instances or an Amazon EC2 Auto Scaling group that acts as the original environment. When you run a blue / green deployment for the first time, you usually use an instance that is already used in the in-place deployment

2) create a blue-green deployment in codedeploy where, in addition to the options required for in-place deployment, specify the following:

During the blue / green deployment process, route traffic from your original environment to the load balancer of the replacement environment.

Reroute traffic to the alternate environment immediately or wait for you to manually route it.

The rate at which traffic is routed to the replacement instance.

Whether the replaced instance terminates or continues to run.

3) when a deployment is created for this deployment, the following occurs:

If you choose to copy the Amazon EC2 Auto Scaling group, the instance will be provisioned for your replacement environment

Specify that the deployed application will be installed on a replacement environment

If the wait time is set in the deployment group, the deployment will be paused, which is the time to test and verify the replacement environment, and if the traffic is not manually routed before waiting, the deployment will stop

Instances in the replacement environment register with the Elastic Load Balancing load balancer, and traffic begins to be routed to these instances

Instances in the original environment are unregistered and processed according to the specifications in the deployment group, either terminating or continuing to run.

The main components of codedeploy:

Application: the name that uniquely identifies the application to be deployed. Code deployment uses this name (used as a container) to ensure that the correct combination of revisions, deployment configurations, and deployment groups is referenced during deployment.

Computing platform: the platform on which codedeploy deploys applications. EC2/ local: can be used as an Amazon EC2 cloud instance or a physical server instance of a local server. Applications created using EC2 or a local computing platform can include executables, configuration files, images, and so on. Deployments using the EC2/ local computing platform manage the way traffic is directed to the instance by using in-place or blue / green deployment types.

Deployment configuration: a set of deployment rules, deployment success conditions, and failure conditions used by codedeploy during deployment. If the deployment is using EC2 or local instances, you can specify a minimum number of running instances for the deployment.

Deployment group: a set of separate instances. The deployment group contains individually marked instances or Amazon EC2 instances in the Amazon EC2 Auto Scaling group

Deployment type: a method used to provide the latest application revisions on an instance in a deployment group.

IAM instance profile: an IAM role attached to an EC2 instance. This profile contains access to S3 and github.

Revision: the lambda deployment revision is a file in yaml format or json format that specifies information about the lambda function to be deployed. The EC2 local deployment revision is an archive file that contains source content (source code, web pages, executables, and deployment scripts) as well as application specification file (AppSpec file). AWS Lambda revisions can be stored in Amazon S3. EC2/ local revisions are stored in Amazon S3 or GitHub.

Service roles: a set of IAM roles used to grant permissions to aws services to access aws service resources. In codedeploy, service roles are used to:

Read the tag applied to the instance and the EC2 auto scaling group name associated with the instance, which enables codedeploy to identify it and deploy the application to the instance; (enable codedeploy to deploy to the instance,)

Perform operations on instances, EC2 auto scaling groups, and elastic load balancing load balancers; (have the right to perform operations)

Publish information to aws SNS topics to send notifications when specified deployment or instance events occur; (give codedeploy the right to send messages to SNS)

Retrieve cloudwatch alert information and set up alert monitoring for deployment.

On how to understand the automatic deployment tool AWS codedeploy overview and main components shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report