Aws codedeploy

Aws codedeploy DEFAULT

Blue/Green deployment with CodeDeploy

The blue/green deployment type uses the blue/green deployment model controlled by CodeDeploy. This deployment type enables you to verify a new deployment of a service before sending production traffic to it. For more information, see What Is CodeDeploy? in the AWS CodeDeploy User Guide.

There are three ways traffic can shift during a blue/green deployment:

  • Canary — Traffic is shifted in two increments. You can choose from predefined canary options that specify the percentage of traffic shifted to your updated task set in the first increment and the interval, in minutes, before the remaining traffic is shifted in the second increment.

  • Linear — Traffic is shifted in equal increments with an equal number of minutes between each increment. You can choose from predefined linear options that specify the percentage of traffic shifted in each increment and the number of minutes between each increment.

  • All-at-once — All traffic is shifted from the original task set to the updated task set all at once.

The following are components of CodeDeploy that Amazon ECS uses when a service uses the blue/green deployment type:

CodeDeploy application

A collection of CodeDeploy resources. This consists of one or more deployment groups.

CodeDeploy deployment group

The deployment settings. This consists of the following:

  • Amazon ECS cluster and service

  • Load balancer target group and listener information

  • Deployment roll back strategy

  • Traffic rerouting settings

  • Original revision termination settings

  • Deployment configuration

  • CloudWatch alarms configuration that can be set up to stop deployments

  • SNS or CloudWatch Events settings for notifications

For more information, see Working with Deployment Groups in the AWS CodeDeploy User Guide.

CodeDeploy deployment configuration

Specifies how CodeDeploy routes production traffic to your replacement task set during a deployment. The following pre-defined linear and canary deployment configuration are available. You can also create custom defined linear and canary deployments as well. For more information, see Working with Deployment Configurations in the AWS CodeDeploy User Guide.

Deployment configuration

Description

Shifts 10 percent of traffic every minute until all traffic is shifted.

Shifts 10 percent of traffic every three minutes until all traffic is shifted.

Shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed five minutes later.

Shifts 10 percent of traffic in the first increment. The remaining 90 percent is deployed 15 minutes later.

Shifts all traffic to the updated Amazon ECS container at once.

Revision

A revision is the CodeDeploy application specification file (AppSpec file). In the AppSpec file, you specify the full ARN of the task definition and the container and port of your replacement task set where traffic is to be routed when a new deployment is created. The container name must be one of the container names referenced in your task definition. If the network configuration or platform version has been updated in the service definition, you must also specify those details in the AppSpec file. You can also specify the Lambda functions to run during the deployment lifecycle events. The Lambda functions allow you to run tests and return metrics during the deployment. For more information, see AppSpec File Reference in the AWS CodeDeploy User Guide.

Consider the following when using the blue/green deployment type:

  • When an Amazon ECS service using the blue/green deployment type is initially created, an Amazon ECS task set is created.

  • You must configure the service to use either an Application Load Balancer or Network Load Balancer. Classic Load Balancers aren't supported. The following are the load balancer requirements:

    • You must add a production listener to the load balancer, which is used to route production traffic.

    • An optional test listener can be added to the load balancer, which is used to route test traffic. If you specify a test listener, CodeDeploy routes your test traffic to the replacement task set during a deployment.

    • Both the production and test listeners must belong to the same load balancer.

    • You must define a target group for the load balancer. The target group routes traffic to the original task set in a service through the production listener.

    • When a Network Load Balancer is used, only the deployment configuration is supported.

  • For services configured to use service auto scaling and the blue/green deployment type, auto scaling is not blocked during a deployment but the deployment may fail under some circumstances. The following describes this behavior in more detail.

    • If a service is scaling and a deployment starts, the green task set is created and CodeDeploy will wait up to an hour for the green task set to reach steady state and won't shift any traffic until it does.

    • If a service is in the process of a blue/green deployment and a scaling event occurs, traffic will continue to shift for 5 minutes. If the service doesn't reach steady state within 5 minutes, CodeDeploy will stop the deployment and mark it as failed.

  • Tasks using the Fargate launch type or the deployment controller types don't support the scheduling strategy.

  • When you initially create a CodeDeploy application and deployment group, you must specify the following:

    • You must define two target groups for the load balancer. One target group should be the initial target group defined for the load balancer when the Amazon ECS service was created. The second target group's only requirement is that it can't be associated with a different load balancer than the one the service uses.

  • When you create a CodeDeploy deployment for an Amazon ECS service, CodeDeploy creates a replacement task set (or green task set) in the deployment. If you added a test listener to the load balancer, CodeDeploy routes your test traffic to the replacement task set. This is when you can run any validation tests. Then CodeDeploy reroutes the production traffic from the original task set to the replacement task set according to the traffic rerouting settings for the deployment group.

Amazon ECS console experience

The service create and service update workflows in the Amazon ECS console supports blue/green deployments.

To create an Amazon ECS service that uses the blue/green deployment type, see Creating an Amazon ECS service.

To update an existing Amazon ECS service that is using the blue/green deployment type, see Updating a service.

When you use the Amazon ECS console to create an Amazon ECS service using the blue/green deployment type, an Amazon ECS task set and the following CodeDeploy resources are created automatically with the following default settings.

Resource

Default Setting

Application name

Deployment group name

Deployment group load balancer info

The load balancer production listener, optional test listener, and target groups specified are added to the deployment group configuration.

Traffic rerouting settings

Traffic rerouting – The default setting is Reroute traffic immediately. You can change it on the CodeDeploy console or by updating the . For more information, see CreateDeploymentConfig in the AWS CodeDeploy API Reference.

Original revision termination settings

The original revision termination settings are configured to wait 1 hour after traffic has been rerouted before terminating the blue task set.

Deployment configuration

The deployment configuration is set to by default, which routes all traffic at one time from the blue task set to the green task set. The deployment configuration can be changed using the AWS CodeDeploy console after the service is created.

Automatic rollback configuration

If a deployment fails, the automatic rollback settings are configured to roll it back.

To view details of an Amazon ECS service using the blue/green deployment type, use the Deployments tab on the Amazon ECS console.

To view the details of a CodeDeploy deployment group in the CodeDeploy console, see View Deployment Group Details with CodeDeploy in the AWS CodeDeploy User Guide.

To modify the settings for a CodeDeploy deployment group in the CodeDeploy console, see Change Deployment Group Settings with CodeDeploy in the AWS CodeDeploy User Guide.

Support for performing a blue/green deployment has been added for AWS CloudFormation. For more information, see Perform Amazon ECS blue/green deployments through CodeDeploy using AWS CloudFormation in the AWS CloudFormation User Guide.

Blue/green deployment required IAM permissions

Amazon ECS blue/green deployments are made possible by a combination of the Amazon ECS and CodeDeploy APIs. IAM users must have the appropriate permissions for these services before they can use Amazon ECS blue/green deployments in the AWS Management Console or with the AWS CLI or SDKs.

In addition to the standard IAM permissions for creating and updating services, Amazon ECS requires the following permissions. These permissions have been added to the IAM policy. For more information, see AmazonECS_FullAccess.

Note

In addition to the standard Amazon ECS permissions required to run tasks and services, IAM users also require permissions to use IAM roles for tasks.

CodeDeploy needs permissions to call Amazon ECS APIs, modify your Elastic Load Balancing, invoke Lambda functions, and describe CloudWatch alarms, as well as permissions to modify your service's desired count on your behalf. Before creating an Amazon ECS service that uses the blue/green deployment type, you must create an IAM role (). For more information, see Amazon ECS CodeDeploy IAM Role.

The Create Service Example and Update Service Example IAM policy examples show the permissions that are required for IAM users to use Amazon ECS blue/green deployments on the AWS Management Console.

Sours: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-bluegreen.html

AWS CodeDeploy Agent

Code ClimateBuild StatusCoverage Status

Build Steps

gitclonehttps://github.com/aws/aws-codedeploy-agent.gitgeminstallbundler -v1.3.5cdaws-codedeploy-agentbundleinstallrakeclean && rake

Starting up the CodeDeploy Agent Locally for manual testing

To stop it:

Integration Test

Please do the build steps mentioned above before running the integration test.

The integration test creates the following

  • An IAM role "codedeploy-agent-integ-test-deployment-role" if it doesn't exist
  • An IAM role "codedeploy-agent-integ-test-instance-role" if it doesn't exist
  • An IAM user "codedeploy-agent-integ-test-instance-user" if it doesn't exist. (Access key will be recreated.)
  • A CodeDeploy application
  • Startup the codedeploy agent on your host
  • A CodeDeploy deployment group with your host in it
  • A CodeDeploy deployment to your host.
  • Local Deployments to your host.

It terminates the test ec2 instance and deletes the CodeDeploy application at the end of each test run. It also terminates any test ec2 instances before starting up the test.

Create your default aws credentials file in the default location (~/.aws/credentials on linux/mac and %USERPROFILE%.awscredentials on windows). Add your AWS access key, secret key, and optionally your session token there. The access key should have permission to create the above mentioned resources. You can also change the default region. Note that temporary credentials won't work.

Sample format of the credentials file:

To run the integration test execute:

Sours: https://github.com/aws/aws-codedeploy-agent
  1. Fuel synonyms
  2. Ffxiv deity
  3. Home assistant

Bamboo Support

With the AWS CodeDeploy task for Bamboo you can deploy applications to EC2 instances automatically, reliably, and rapidly. Additionally, AWS CodeDeploy keeps track of the whole deployment process.

On this page:

Overview

The AWS CodeDeploy task compresses the specified directory with an AppSpec file into a .zip file, uploads the file to Amazon S3, and starts the deployment according to the configuration provided in the CodeDeploy application.

Before you begin

There are several requirements that must be met before you can start using the AWS CodeDeploy task. In short, you must configure the following in your AWS Management Console:

  • an EC2 instance with a tagged deployment group
  • a CodeDeploy application
  • an IAM user

  • an S3 bucket

For more guidelines about your AWS configuration, see AWS CodeDeploy configuration for Bamboo.

The content that you want to be zipped and deployed requires a specific structure. For more information, see Preparing files for deployment.

Adding an AWS CodeDeploy task to a Bamboo plan

To use the CodeDeploy task:

  1. Go to the plan configuration.
  2. Select Add task.
  3. Select AWS CodeDeploy.
  4. Provide the following details:
    FieldDescription
    Task descriptionA short description of the task.
    Disable this taskSelect the check box to skip this task in the build.
    Add condition to task Make task run only when a certain condition is met. 
    You can find conditions on Atlassian Marketplace or implement your own.  
    AWS credentials

    You can select existing AWS credentials from the list or add new AWS credentials. The newly created AWS credentials are added to the shared credentials list in Bamboo.  

    To make existing AWS credentials available for selection within the AWS CodeDeploy task in Bamboo, add them to Shared credentials.

    Region

    A region in which the application is deployed.

    Deployable content directory

    Location of the directory that contains the deployable content and an AppSpec file. By default, it is the root build directory. The content of the directory is compressed into a .zip file and sent to Amazon S3 bucket for deployment. For more information, see Preparing files for deployment.

    Amazon S3 bucketThe name of an S3 bucket from which the deployable content (your app and the AppSpec file) is deployed. Start typing to open a selection list of the existing S3 buckets that are available for the AWS credentials provided in the task configuration. For more information, see Amazon S3 bucket.
    Application nameThe name of the CodeDeploy application that you created in the AWS management console. For more information, see AWS CodeDeploy application.
    Deployment groupStart typing to open a list of deployment groups available for the Application name specified in the previous step.

AWS CodeDeploy configuration for Bamboo

The infrastructure setup is described in detail by AWS. For more information, see Getting Started with AWS CodeDeploy.

Atlassian provides guidelines for the following:

IAM user

We recommend creating a dedicated CodeDeploy IAM user or group.

The following policy gives full permissions to Amazon S3 buckets, CodeDeploy application and deployment group:

For more examples of policies, see Bucket Policy Examples.

AWS CodeDeploy application

Each CodeDeploy application holds information about the deployment configuration.

For more information, see Create an Application with AWS CodeDeploy.

Amazon S3 bucket

An Amazon S3 bucket must exist. We recommend creating a dedicated CodeDeploy S3 bucket that is located in the same region as the instances to which you want to deploy the application.

For more information about how to grant access to S3 buckets, see IAM user.

To make existing AWS credentials available for selection within the AWS CodeDeploy task in Bamboo, add them to Shared credentials.

Preparing files for deployment

The deployable content that is compressed and sent to an Amazon S3 bucket is called a revision and it consists of the application and an AppSpec (Application Specification) file.

Examples of revisions

Sours: https://confluence.atlassian.com/bamboo/using-the-aws-codedeploy-task-750396059.html
Code Deploy Setup (IAM, EC2)

In this tutorial, you will learn how to deploy application code to a virtual machine on AWS. You will use AWS CodeDeploy, a service that automates code deployments to AWS or on-premises servers, to deploy code to virtual machines that you create and manage with Amazon EC2. 

Everything done in this tutorial is free tier eligible.

You will need to create a key pair to access your virtual machine with Amazon EC2.  If you already have a key pair, skip ahead to Step 2.

a. When you click here, the AWS Management Console will open in a new browser window, so you can keep this step-by-step guide open.  Click Create Key Pair.

tmt-codeDeploy-20
tmt-codeDeploy-20

b.  Name your key pair.  For this tutorial, we will use MyFirstKey. Click Create.

Note: Amazon EC2 uses public-key cryptography to encrypt and decrypt login information. To learn more about key pairs, see Amazon EC2 Key Pairs.

tmt-codeDeploy-19
tmt-codeDeploy-19

a. Click the home icon on the upper left corner of the AWS Management Console.  Find CodeDeploy under Developer Tools and click to open the AWS CodeDeploy Console.

tmt-codeDeploy-0
tmt-codeDeploy-0

b. In the AWS CodeDeploy Console, click Get Started Now.

If you already have applications, look to the right column and click Create Deployment Walkthrough.

tmt-codeDeploy-1
tmt-codeDeploy-1

c. Select Sample Deployment and click Next.

tmt-codeDeploy-2
tmt-codeDeploy-2

You will need to launch an AWS virtual machine to deploy your code on.  AWS virtual machines are known as Amazon EC2 instances, or just 'instances' for short. In this step, we will launch three EC2 instances using a pre-configured EC2 template.

a. Click the home icon on the upper left corner of the AWS Management Console.  Find CodeDeploy under Developer Tools and click to open the AWS CodeDeploy Console.

tmt-codeDeploy-0
tmt-codeDeploy-0

You will configure your instance settings with the options below:

  • Operating System: You can choose the OS of your EC2 Instance.  For this tutorial, we will use Amazon Linux
  • Instance Type:  For this tutorial, the t1.micro instance type has been selected as the default value to stay within the free tier. Amazon EC2 provides a wide selection of instance types optimized to fit different use cases. Instance types comprise varying combinations of CPU, memory, storage, and networking capacity and give you the flexibility to choose the appropriate mix of resources for your applications.  
  • Key Pair Name: From the drop-down list, choose the Amazon EC2 instance key pair you created in step 1, MyFirstKey, to connect to the Amazon EC2 instances. You can also choose a key pair you already have. 
  • Tag Key and Value: AWS CodeDeploy will use this tag key and value to locate the instances during deployments. You can leave the default values.

Click Launch Instances.

Note: This step may take several minutes to complete.  As you wait, feel free to review this tutorial with the video below:

tmt-codeDeploy-4
tmt-codeDeploy-4

a. In the Application Name box, enter HelloWorld as the name for your sample application and click Next Step.

tmt-codeDeploy-5
tmt-codeDeploy-5

b. Review information about your application revision, such as its location and description.

Note: You have the option to download the sample bundle. In this view, you can review information about the application revision you’d like to deploy to EC2. An application revision is an archive file containing source content—such as source code, web pages, executable files, and deployment scripts—along with an application specification file (AppSpec file). The AppSpec file helps CodeDeploy map the source files in your revision to their destinations and run scripts at various stages of the deployment.

Click Next Step

tmt-codeDeploy-7
tmt-codeDeploy-7

A deployment group is a set of individual EC2 instances that CodeDeploy deploys revisions to. A deployment group contains individually tagged instances, Amazon EC2 instances in Auto Scaling groups, or both.

In the Deployment Group Name box, leave the proposed deployment group name (DemoFleet) as is.

You will then specify the Amazon EC2 instances to deploy by entering the key-value pair in the Seach by Amazon EC2 Tags section:

  • The Key and Value columns should be autopopulated with the values from Step 3.
  • The Instances column displays the number of EC2 instances that you will deploy code to.  For this tutorial, we have launched and pre-configured three EC2 instances and these instances have already been tagged together into a deployment group.

Choose Next Step.

tmt-codeDeploy-8
tmt-codeDeploy-8

In this step, you will grant AWS CodeDeploy permission to deploy to your instances. You create a role for an AWS service when you want to grant permissions to a service like Amazon EC2 or AWS CodeDeploy. These services can access AWS resources, so you create a role to determine what the service is allowed to do with those resources.

Service Role: Choose Create a new service role.  If you already have a service role, you can choose Use an existing service role.

Role Name: You can accept default value of CodeDeploy_HelloWorld.  If you are using an existing service role, choose it from the Role Name drop-down list.

Click Next Step.

tmt-codeDeploy-9
tmt-codeDeploy-9

In this step, we will select a deployment configuration and then initiate the deployment to our three EC2 instances. By the end of this step, we'll have successfully deployed a live and running website, which we can visit online.

a. The deployment configuration lets you determine how many instances to simultaneously deploy your application revisions to and describes the success and failure conditions for the deployment. For example, using the default configuration (“One at a Time”), if you deploy your application to 3 instances, this configuration will deploy to one instance at a time.

Accept the Default Deployment Configuration and click Next Step.

tmt-codeDeploy-10
tmt-codeDeploy-10

b. Review the details of your deployment and click Deploy Now.

Note: This can take several minutes to complete.

tmt-codeDeploy-11
tmt-codeDeploy-11

c.  Our sample revision deploys a single web page to each instance. Once all three instances are completed, click View All Instances.

tmt-codeDeploy-14
tmt-codeDeploy-14

d.  Click the instance ID for one of the instances you deployed to. This will take you to the EC2 dashboard where you can view the instance that you launched.

tmt-codeDeploy-15
tmt-codeDeploy-15

e. To verify whether your sample application deployed successfully, copy the address in the Public DNS field in the bottom panel, paste the address into your browser, and you will see your live web page.

tmt-codeDeploy-21
tmt-codeDeploy-21

To avoid future charges, you must clean up the resources used in this tutorial. The EC2 instances you launched for this tutorial will keep running unless you terminate them.

a. In the EC2 console, the search bar is autopopulated with a search filter for the Instance ID.  Delete this filter and you will see all the instances launched by CodeDeploy.  

tmt-codeDeploy-16a
tmt-codeDeploy-16a

b. Select the boxes of each Amazon EC2 instance to terminate. Select Actions,  Instance State, and click Terminate.

When prompted, click Yes, Terminate.

tmt-codeDeploy-18a
tmt-codeDeploy-18a

You have successfully created and completed your very first code deployment to Amazon EC2 instances using AWS CodeDeploy. Using a provided template, you first launched three instances that were pre-configured with the proper tags and installed with the agent necessary to use AWS CodeDeploy. Finally, you prepared your application for deployment, granted CodeDeploy permission to deploy to your instances, and then successfully deployed your code.

Now that you have completed a sample deployment to Amazon EC2 instances using AWS CodeDeploy, you can begin learning how to use CodeDeploy in your own applications. Visit the CodeDeploy documentation to learn how to launch EC2 instances and then configure the instances so that CodeDeploy can deploy code to them. In our tutorial, we simplified those configuration steps to help you learn and experience how CodeDeploy works.

Learn how to configure AWS CodeDeploy instances

Sours: https://aws.amazon.com/getting-started/tutorials/deploy-code-vm/

Codedeploy aws

I'm still a newbie in this business. Bob Mason narrowed his eyes, peering into the thick streaks of rain. A fuel truck was moving in front of them, a semi-trailer loaded with brand new Fords was propping up behind them from below. The semi-trailer overtook them on the left as it searched for a landmark - one of the winemaker's finest tasting establishments.

Behind the next gentle hill was a large gray building - a gigantic old barn that was now impossible to find any trace of paint on.

AWS CodeDeploy - Pipeline - Setup - Deploy application on EC2 using GitHub as source

We were talking about something abstract, but I was terribly shy, because very soon I will be sucking his cock. We arrived 15 minutes later, went up to his floor and entered the apartment, the apartment was, albeit in the literal sense of the word, renovated.

But there was no furniture at all, only a wide air mattress in the center of the room.

You will also like:

A rich sex life provoked noticeable changes even in her daily behavior. Olga seemed to be rediscovering herself. And today, after a night of wild sex with two hungry males at the same time, she felt even more desirable than before.



211 212 213 214 215