Skip to content

Instantly share code, notes, and snippets.

@alexcasalboni
Last active October 2, 2019 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcasalboni/6c5a630f53505ee0c6e3adcdfe5bd02c to your computer and use it in GitHub Desktop.
Save alexcasalboni/6c5a630f53505ee0c6e3adcdfe5bd02c to your computer and use it in GitHub Desktop.
AWS CodeDeploy - Lambda hook (Node.js)
const AWS = require('aws-sdk');
const codedeploy = new AWS.CodeDeploy();
exports.handler = async (event, context) => {
const {DeploymentId, LifecycleEventHookExecutionId} = event;
const functionToTest = process.env.NewVersion; // to be defined in CFN
/* Enter validation tests here */
const status = 'Succeeded'; // 'Succeeded' or 'Failed'
// Pass AWS CodeDeploy the prepared validation test results.
return await codedeploy.putLifecycleEventHookExecutionStatus({
deploymentId: DeploymentId,
lifecycleEventHookExecutionId: LifecycleEventHookExecutionId,
status: status
}).promise();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment