Category: AWS CodeDeploy


New – Notifications for AWS CodeDeploy Events

by Jeff Barr | on | in AWS CodeDeploy | | Comments

AWS CodeDeploy is a service that helps you to deploy your code to a fleet of EC2 or on-premises instances while taking care to leave as much of the fleet online as possible. CodeDeploy was designed to work with fleets that range in size from a single instance all the way up to thousands of instances (see my post, New AWS Tools for Code Management and Deployment for more information).

Notifications for CodeDeploy
In order to make it easier for you to use CodeDeploy as a part of your overall build, test, and deployment pipeline, we are introducing a new notification system today. You can now create triggers that send Amazon SNS notifications before, during, and after the deployment process for your applications. Triggers can be set for the deployment as a whole or for the individual instances targeted by the deployment, and are sent on both successes and failures. Here is the full list of triggers:

  • DEPLOYMENT_START
  • DEPLOYMENT_SUCCESS
  • DEPLOYMENT_FAILURE
  • DEPLOYMENT_STOP
  • INSTANCE_START
  • INSTANCE_SUCCESS
  • INSTANCE_FAILURE

You can create up to 10 triggers per application. You can connect several triggers to a single topic, or you can send each trigger to a distinct topic. You can use any of the delivery protocols supported by SNS (http, https, email, SMS, and mobile push). You can also invoke a Lambda function.

Creating a Trigger
Triggers can be created using the AWS Management Console or the AWS Command Line Interface (CLI). I’ll use the Console in the post. I set up the sample CodeDeploy application (three t2.micro instances):

And then I did an initial deployment:

Then I created an SNS topic, subscribed to it via email, and confirmed the subscription:

I returned to the Console and opened up my application within CodeDeploy:

I opened up IAM in another tab and updated the policy associated with the Service Role, giving it permission to write to SNS (you won’t need to do this if you select the managed AWSCodeDeployRole for your application):

Back in CodeDeploy, I clicked on Create trigger, entered a name, chose my events (all of them for this example), and selected my SNS topic from the dropdown:

I could also have chosen individual events:

My trigger was created and displayed in the Console:

CodeDeploy sent a confirming message to the topic and it was at the top of my Inbox:

Then I initiated a deployment and waited for the emails to arrive! Here’s what they looked like:

I used email for illustrative purposes; in a real-world application you would probably want to write some code to catch and handle the messages.

Triggers are available now and you can start using them today!

Jeff;

 

 

AWS CodeDeploy Update – New Support for On-Premises Instances

by Jeff Barr | on | in Amazon EC2, AWS CodeDeploy |

My colleague Andy Troutman wrote up the guest post below to share news of a powerful new way to use AWS CodeDeploy.

— Jeff;


Customers use AWS CodeDeploy to manage application updates to their Amazon EC2 instances. CodeDeploy allows developers and administrators to centrally control and track their application deployments across different development, testing, and production environments. CodeDeploy is built using many of the lessons learned from Amazon’s internal deployment systems, and focuses on coordinating the rollout of application updates in a way that’s clear, reproducible, and non-impactful to application users. To learn more about how to integrate CodeDeploy into your existing app management process, visit the CodeDeploy detail page.

Customers who are using CodeDeploy to manage their Amazon Elastic Compute Cloud (EC2) instances have asked to be able to use the same fleet coordination features to deploy code to their on-premises instances. Today we’re happy to make the functionality of CodeDeploy available for use on a customer’s own servers, in addition to Amazon EC2.

Advantages of CodeDeploy for On-Premises Instances
Customers can now manage their EC2 and on-premises application deployments using a single solution. Here are some of the advantages:

  • Coordinate a rolling update across a collection of EC2 and/or on-premises instances. CodeDeploy will actively track the outcome of each instance update, and use this data to safely select the next set of updates, or to stop the deployment in a case where an application update isn’t going as expected.
  • Tag on-premises instances the same as with EC2 instances to define deployment groups. You can create multiple unique groups to define separate application stages such as “Development”, “Test”, “QA”, “Production”, and so forth.
  • Deployment groups can be composed of on-premises instances, static EC2 tags, or dynamically changing AWS Auto Scaling groups. New Auto Scaling capacity is automatically deployed to with CodeDeploy.
  • In cases where a deployment fails on an EC2 instance or on-premises instance, CodeDeploy will immediately make the last 4k of deployment log data available to customers in the console, making it easy to quickly troubleshoot a failed application deployment.
  • Monitor and update the state of your on-premises instances directly from the CodeDeploy Console or AWS Command Line Interface (CLI).
  • Since CodeDeploy uses a pull-based model for our agent, on-premises instances only need outbound HTTPS access to the appropriate CodeDeploy endpoint (read about Regions and Endpoints to learn more).  Your instance and firewall do not need to allow SSH access or any other inbound connection to trigger a deployment.
  • Use CodeDeploy to update both Linux and Windows EC2 instances or on-premises instances. From 1 to 10,000+, CodeDeploy is architected to do deployments at any scale.

Getting Started
The easiest way to start managing on-premises instances with AWS CodeDeploy is via the AWS Command Line Interface (CLI). You can install the AWS CLI on your desktop or directly on the on-premises instance.  Once you have the CLI  installed, you’ll be able to get your first on-premises instance running with 3 steps:

  1. Issue the aws deploy register command, which will create a new IAM user and associate it with the on-premises instance, register the instance with AWS CodeDeploy, and tag the instance with any tags specified.
  2. Issue the aws deploy install command from your on-premises instance. This will install the CodeDeploy agent onto the instance and configure it to communicate with a supported AWS Region. Today, CodeDeploy is available in the US East (Northern Virginia) and US West (Oregon) regions.
  3. Update or create a new CodeDeploy Deployment Group to add your on-premises instance to a new or existing application. You can do this step from the CLI or via the CodeDeploy console.

Once complete, you can deploy to your on-premises instance in the exact same way as any EC2 instance. For more details on the setup steps, please take a look at the CodeDeploy documentation.

Pricing and Availability
You pay $0.02 per on-premises instance update using AWS CodeDeploy; there are no minimum fees and no upfront commitments. You will only be charged if CodeDeploy begins an update on an instance. There is no additional charge for code deployments to Amazon EC2 instances through AWS CodeDeploy.

Customers may register their on-premises instances against any of our available regions. For the best availability, we recommend that customers segment their on-premises instances to talk to the closest available region, in much the same way they would segment EC2 instances by region. For more information, please see the CodeDeploy Pricing and regions FAQ.

Andy Troutman, Software Development Manager