In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Many beginners are not very clear about how to deploy codedeploy in AWS's load balancer tool. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
Elastic Load Balancing provides three load balancers that can be used for CodeDeploy deployment: Classic Load Balancer, Application Load Balancer, and Network Load Balancer.
Traditional load balancer routing and load balancing are carried out at the transport layer (TCP/SSL) or application layer (HTTP/HTTPS). It supports EC2-Classic or VPC. Application load balancer
Routing and load balancing takes place at the application layer (HTTP/HTTPS) and supports path-based routing. It can route requests to a port on each EC2 instance or container instance in your Virtual Private Cloud (VPC).
Be careful
The application load balancer target group must have a target type instance
Network Load Balancer
Routing and load balancing occurs at the transport layer (TCP/UDP layer, that is, layer 4), based on address information extracted from the TCP packet header rather than from the packet content. Network Load Balancer can handle burst traffic, retain the source IP of the client, and use fixed IP during the life of the load balancer
The role of load balancer in CodeDeploy deployment
During CodeDeploy deployment, the load balancer prevents Internet traffic from being routed to instances that are not ready, are currently being deployed, or are no longer needed by the environment. However, the exact role of the load balancer depends on whether it is used for blue / green deployment or in-place deployment.
Be careful
The use of Elastic Load Balancing load balancer is required in blue / green deployments and optional in in-place deployments.
Blue / green deployment
Rerouting instance traffic based on Elastic Load Balancing load balancer is the basis of CodeDeploy blue / green deployment.
During a blue / green deployment, the load balancer allows traffic to be routed to a new instance in the deployment group that has deployed the latest application revision (replacement environment), based on the rules you specify, and then blocks traffic (the original environment) of the old instance running the earlier application revision.
After the instance in the replacement environment registers the load balancer, the instance in the original environment is unregistered and terminated according to your needs.
For blue / green deployments, you can specify traditional load balancers, application load balancers, or Network Load Balancer in the deployment group. You can use the CodeDeploy console or AWS CLI to add load balancers to the deployment group.
On-site deployment
In the process of in-place deployment, the load balancer can prevent Internet traffic from being routed to the instance to be deployed; after the instance is deployed, the traffic routing to the instance can be restored.
If the load balancer is not used during in-place deployment, Internet traffic may still be directed to the instance during deployment. As a result, your customers may experience interrupted, incomplete, or outdated Web applications. When the Elastic Load Balancing load balancer is used for in-place deployment, the instances in the deployment group are unregistered from the load balancer, updated to the latest application revision, and re-registered with the load balancer for the same deployment group after successful deployment.
For in-place deployment, you can specify a traditional load balancer, an application load balancer, or a Network Load Balancer. You can specify the load balancer during the configuration of the deployment group, or use the script provided by CodeDeploy to implement the load balancer.
You can use the CodeDeploy console or AWS CLI to add a load balancer to a deployment group
Use scripts to set up load balancers for in-place deployment
Use the deployment declaration cycle script to set up load balancing for the in-place deployment by performing the steps in the following procedure.
Be careful
You should use the CodeDeployDefault.OneAtATime deployment configuration only when using scripts to set up load balancers for in-place deployment. Concurrent running is not supported, and CodeDeployDefault.OneAtATime settings ensure sequential execution of scripts
In the CodeDeploy sample repository on GitHub, we provide instructions and examples that you can adjust to use the CodeDeploy Elastic Load Balancing load balancer. These repositories contain three sample scripts-register_with_elb.sh, deregister_from_elb.sh, and common_functions.sh-that provide all the code you need to get started. Simply edit the placeholders in the three scripts and then reference the scripts from the appspec.yml file.
To set up an in-place deployment in CodeDeploy using an Amazon EC2 instance that is registered with the Elastic Load Balancing load balancer:
Download an example of the type of load balancer to be used for in-place deployment:
Traditional load balancer
Application load balancer or Network Load Balancer (the same script can be used for either type)
Ensure that each target Amazon EC2 instance has AWS CLI installed.
Ensure that each target Amazon EC2 instance has at least one IAM instance profile attached and has elasticloadbalancing:* and autoscaling:* permissions.
Include the deployment lifecycle event scripts (register_with_elb.sh, deregister_from_elb.sh, and common_functions.sh) in the application's source code directory.
In the application revised appspec.yml, provides instructions for CodeDeploy to run register_with_elb.sh scripts during the ApplicationStart event and deregister_from_elb.sh scripts during the ApplicationStop event.
If the instance belongs to an Amazon EC2 Auto Scaling group, you can skip this step.
In the common_functions.sh script:
If you are using a traditional load balancer, specify the name of the Elastic Load Balancing load balancer in ELB_LIST= "" and make any necessary changes to the other deployment settings in the file.
If you are using an application load balancer or Network Load Balancer, specify the name of the Elastic Load Balancing target group in TARGET_GROUP_LIST= "and make any necessary changes to the other deployment settings in the file.
Bind the application's source code, appspec.yml, and deployment lifecycle event scripts to an application revision, and then upload the revision. Deploy the revision to the Amazon EC2 instance. During deployment, the deployment lifecycle event script unregisters the Amazon EC2 instance with the load balancer, waits for the connection to be exhausted, and then re-registers the Amazon EC2 instance with the load balancer after the deployment is complete.
Deploy CodeDeploy revisions from GitHub
To deploy the application revision from the GitHub repository to the instance, perform the following steps:
Create revisions that are compatible with CodeDeploy and the type of Amazon EC2 instance to which you will deploy.
To create a compatible version, follow the instructions for planning the revision of CodeDeploy and adding the application specification file to the revision of CodeDeploy.
Use your GitHub account to add your revisions to the GitHub repository.
Use the create deployment page in the CodeDeploy console or use the AWS CLI create-deployment command to deploy the revision from the GitHub repository to the target instance that has been configured for use in the CodeDeploy deployment.
If you need to invoke the create-deployment command, you must first use the create deployment page of this console to grant CodeDeploy permission to interact with GitHub on behalf of your preferred GitHub account for the specified application. Each application only needs to do this once.
Interaction between github and codedeploy:
Authentication of applications in CodeDeploy by GitHub
After CodeDeploy is given permission to interact with GitHub, the association between the GitHub account and the application is stored in CodeDeploy. You can link your application to another GitHub account. You can also revoke permissions for CodeDeploy to interact with GitHub.
Link the GitHub account to the application in CodeDeploy
Sign in to the AWS Management console and open the CodeDeploy console at https://console.aws.amazon.com/codedeploy.
Be careful
Log in using the same account or IAM user information you used in getting started with CodeDeploy.
In the navigation pane, expand Deploy, and then select Applications.
Select the application you want to link to another GitHub account.
If the application does not have a deployment group, select create a deployment group to create a deployment group
"from deployment, select create deployment."
Be careful
There is no need to create a new deployment. This is currently the only way to link other GitHub accounts to the application.
In the deployment settings, for the revision type, the selected my application will be stored in GitHub.
Do one of the following:
To create a connection to the GitHub account for the CodeDeploy application, log out of GitHub in a separate Web browser tab. "in the GitHub token name, type a name to identify the connection, and then select Connect to GitHub." The page prompts the authorized CodeDeploy to interact with the application's GitHub. Proceed to step 10.
"to use the connection that you have created, in GitHub token name, select its name, and then select Connect to GitHub." Continue with step 8.
To create connections to other GitHub accounts, log out of GitHub in a separate Web browser tab. "in the GitHub token name, type a name to identify the connection, and then select Connect to GitHub." The page prompts the authorized CodeDeploy to interact with the application's GitHub. Proceed to step 10.
If you have not logged in to GitHub, follow the instructions on the Sign in page to log in using the GitHub account to which you want to link the application.
Select Authorize application. GitHub provides CodeDeploy with permission to interact with GitHub on behalf of the logged-in GitHub account of the selected application.
If you need to create a deployment, select Cancel
Revoke CodeDeploy's permission to interact with GitHub
Log in to GitHub using the credentials of the GitHub account for which you want to revoke CodeDeploy privileges.
Open the GitHub application page, find CodeDeploy in the list of authorized applications, and follow the GitHub procedure used to revoke the authorization of the application.
CodeDeploy interacts with private and public GitHub repositories
CodeDeploy supports deployment of applications from both private and public GitHub repositories. When you grant CodeDeploy access to GitHub on your behalf, all private GitHub repositories that CodeDeploy has access to for your GitHub account will have read and write access. However, CodeDeploy can only be read from the GitHub repository. It will not write to any private GitHub repository.
CodeDeploy interacts with GitHub repositories hosted by the organization
By default, the organization's managed GitHub repository (as opposed to the account's own private or public repository) does not grant access to third-party applications, including CodeDeploy. If you enable your organization's third-party application restrictions in GitHub and you try to deploy code from its GitHub repository, the deployment will fail. There are two ways to solve this problem.
As a member of an organization, you can ask the owner of the organization to approve access to the CodeDeploy. The steps to request this access depend on whether you have authorized a single account to access CodeDeploy
Deploy automatically from CodePipeline using CodeDeploy
When the source code changes, you can trigger the deployment from CodePipeline
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.