Wednesday, February 17, 2016

New - Notifications for AWS CodeDeploy Events

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_u] 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_u] 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;




No comments:

Post a Comment