-
Notifications
You must be signed in to change notification settings - Fork 7
[first cut] update rollback failed lambda #93
base: master
Are you sure you want to change the base?
Conversation
Apologies for the linting errors, looks like I didn't have that set up ! Will push changes with the right liniting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aarthykc I left some comments in this review. Looks like you're nearly there, but there are a few things that need to be changed.
I will look at the tests separately.
name: 'updateRollbackFailed', | ||
sourcePath: 'rules/updateRollbackFailed.js', | ||
parameters: { | ||
includeResources: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this parameter be called otherStacks
? @aarthykc do you think this would be more intuitive?
{ | ||
Effect: 'Allow', | ||
Action: [ | ||
'cloudformation:*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aarthykc this should be more specific, so that it adheres to least privilege. ie. i think this only needs to be cloudformation:DescribeStacks
if (err) return callback(err); | ||
else { | ||
data[0].forEach(function(i) { | ||
if(i.name.indexOf('production') > -1 && i.status.indexOf('UPDATE_COMPLETE') > -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aarthykc if I am reading this correctly, this will also catch stacks that are in any of these other status states shown in the list under Stack Status Codes here http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-describing-stacks.html
Is there a reason not to check for the exact match of UPDATE_ROLLBACK_FAILED?
|
||
function describeStacks(params, callback) { | ||
var q1 = queue(1); | ||
var cloudformation = new AWS.CloudFormation({region: 'us-east-1'}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aarthykc right now this just checks stacks in us-east-1. It should check for this state on stacks in all regions.
There are times when stacks are caught in
UPDATE_ROLLBACK_FAILED
and it's good to be alerted when a stack is in such a state. Since there are no cloudwatch events that currently track this, the easiest way was to create a lambda function that would do that looks at which productions are currently in theUPDATE_ROLLBACK_FAILED
state and alert in case that is the case.I'm currently testing for whether the stack is in
UPDATE_COMPLETE
to see if it sends a notification will change this back toUPDATE_ROLLBACK_FAILED
when I confirm this works.cc @ianshward, @emilymcafee - does this look okay ?
Next actions: