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 deploy AWS automatic deployment tool codedeploy

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to deploy AWS automatic deployment tool codedeploy, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1) deploy on the AWS lambda platform:

Three major parts: content to be deployed-- > configuration for deployment-- > updated version of the lambda function

The process of deployment: upload the revised application-- > create an application-- > specify the deployment group-- > specify the configuration for the deployment-- > specify an appspec file-- > deploy-- > check the deployment results-- > redeploy as needed if there is a problem.

2) deployment on AWS ECS platform:

Prerequisite for deployment:

When you create a codedeploy deployment group, you must specify an ECS cluster that contains ECS services

Codedeploy must have ECS service enabled. By default, ECS service is enabled for ECS deployment. When creating a deployment group, you need to select the ECS service to deploy the ECS cluster.

ECS services that are to be updated with ECS deployment must use ELB, either an application load balancer or Network Load Balancer. It is officially recommended to use application load balancers so that features such as dynamic port mapping and path-based routing and priority rules can be taken advantage of. When creating a deployment group for a CodeDeploy application, you need to specify a load balancer

When creating a deployment group, you need to specify one or two listeners, which are load balancers that direct traffic to the target group. (if you use the ECS console to create an ECS service, the system creates a listener)

An ECS deployment requires two target groups, one for the original task set of the ECS program and one for the replacement task set of the ECS program. During deployment, codedeploy creates a replacement task set and replaces the traffic to the new task set, and the target group needs to be specified when creating the deployment group. (during deployment, CodeDeploy determines which target group is associated with a task set in the ECS service with a status of PRIMARY (which is the original task set), associates one target group with it, and then associates another target group with the replacement task set. If you perform another deployment, the target group associated with the original task set of the current deployment will be associated with the replacement task set of the next deployment.

The ARN of the task definition needs to be specified in the AppSpec file of the CodeDeploy application (task definition is required to run the Docker container containing the ECS application)

The name of the container needs to be specified in the appspec file of the codedeploy application, and the container specified in appapec file must be one of the ECS task definitions. The Docker container contains everything your software application needs to run. The load balancer directs traffic to containers in the Amazon ECS application task set)

During ECS deployment, the load balancer directs traffic to the port on the container specified by the AppSpec file of your CodeDeploy application, which needs to be specified in the AppSpec file of the CodeDeploy application.

Deployment components: what to deploy-- > deployed configuration-- > alternative task set for ECS

Deployment workflow: create an ECS deployment and set the deployment controller to codedeploy-- > create a codedeploy application-- > create a deployment group-- > specify an APPspec file-- > deploy-- > check deployment results-- > return to deployment after problems occur.

3) deployment on EC2 or local computing platform

Deployment components: what to deploy-- > configuration for deployment-- > deployment groups and scaling groups

The main deployment workflow: create an application-- > specify deployment group-- > specify the configuration for deployment-- > update what needs to be deployed-- > deploy-- > check deployment-- > return to deployment when there is a problem.

Detailed explanation of the steps:

1. Create an application by specifying the name of the computing platform that uniquely represents the application revision and the application that you want to deploy

two。 When you set up a deployment group, you specify the deployment type and the instance where you want to deploy the application revision. The in-place deployment updates the instance with the latest application revision. Blue / green deployment registers a set of replacement instances of the deployment group with the load balancer and unregisters the original instance, you can specify a label or Amazon EC2 Auto Scaling group name to apply to the instance, in all cases the instance must be configured for use in the deployment (that is, they must be marked or belong to the Amazon EC2 Auto Scaling group), and the CodeDeploy agent is installed and running, and AWS provides an AWS CloudFormation template You can use this template to quickly set up Amazon EC2 instances based on Amazon Linux or Windows Server, and also provides independent CodeDeploy agents, configure Amazon SNS notifications-create triggers to send notifications to subscribers to Amazon SNS topics when specified events (for example, success or failure events) occur in the deployment and instance, alert-based deployment management-enables Amazon CloudWatch alert monitoring To stop deployment when metrics exceed or fall below the threshold set in CloudWatch, automatically deploy rollback-configure deployment so that it automatically rolls back to a known-good version when deployment fails or an alert threshold is reached.

3. Specify the deployment configuration to indicate how many instances will deploy the application revision at the same time and describe the conditions for success and failure

4. Upload application revisions to Amazon S3 or GitHub. In addition to the files to be deployed and all scripts to be run during deployment, you must also include application specification file (AppSpec file). This file contains deployment instructions, such as the location on each instance to which you want to copy the file, and when to run the deployment script.

5. Deploy the application revision to the deployment group. The CodeDeploy agent for each instance in the deployment group copies your application revisions from Amazon S3 or GitHub to that instance. The CodeDeploy agent then unbundles the revision, copies the file to the specified location using AppSpec file, and executes any deployment script.

6. Check the deployment results

7. Revising, redeploying.

Note: here are the things you need to do before you start.

Set up an instance

You need to set up the instance before you can deploy the application revision for the first time. If an application revision requires three production servers and two backup servers, you will start or use five instances.

To manually preconfigure an instance:

Install the CodeDeploy agent on the instance. The CodeDeploy agent can be installed on Amazon Linux, Ubuntu Server, RHEL, and Windows Server instances.

Enable tagging if you want to use tags to identify instances in the deployment group. CodeDeploy relies on tags to identify instances and group them into CodeDeploy deployment groups. Although the getting started tutorial uses both keys and values, you can use only keys or values to define labels for deployment groups.

Start the EC2 instance with the IAM instance configuration file attached. The IAM instance configuration file must be attached to the started EC2 instance so that the CodeDeploy agent can verify the identity of the instance.

Create a service role. Provide access to the service so that CodeDeploy can expand the tags in your AWS account.

For the initial deployment, the AWS CloudFormation template will do all of this for you. It creates and configures a single new Amazon EC2 instance based on the Amazon Linux or Windows Server where the CodeDeploy agent is installed.

Be careful

For blue / green deployment, you can choose to use your existing instance to replace the environment, or you can choose to have CodeDeploy preset a new instance for you during deployment}

These are all the contents of the article "how to deploy AWS Automated deployment tool codedeploy". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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