1. 程式人生 > >Configure CloudFormation Email Notifications for ROLLBACK_IN_PROGRESS

Configure CloudFormation Email Notifications for ROLLBACK_IN_PROGRESS

topic_arn = "{SNS topic ARN for email alerts}";
var AWS = require('aws-sdk'); 
AWS.config.region_array = topic_arn.split(':'); // splits the ARN in to and array 
AWS.config.region = AWS.config.region_array[3];  // makes the 4th variable in the array (will always be the region)

// ####################   BEGIN LOGGING   ########################

console.log(topic_arn);   // just for logging to the that the var was parsed correctly
console.log(AWS.config.region_array); // to see if the SPLIT command worked
console.log(AWS.config.region_array[3]); // to see if it got the region correctly
console.log(AWS.config.region); // to confirm that it set the AWS.config.region to the correct region from the ARN

// ####################  END LOGGING (you can remove this logging section)  ########################

exports.handler = function(event, context) {
    const message = event.Records[0].Sns.Message;
    if (message.indexOf("ROLLBACK_IN_PROGRESS") > -1) {
        var fields = message.split("\n");
        subject = fields[11].replace(/['']+/g, '');
        send_SNS_notification(subject, message);   
    }
};

function send_SNS_notification(subject, message) {
    var sns = new AWS.SNS();
    subject = subject + " is in ROLLBACK_IN_PROGRESS";
    sns.publish({ 
        Subject: subject,
        Message: message,
        TopicArn: topic_arn
    }, function(err, data) {
        if (err) {
            console.log(err.stack);
            return;
        } 
        console.log('push sent');
        console.log(data);
    });
}

相關推薦

Configure CloudFormation Email Notifications for ROLLBACK_IN_PROGRESS

topic_arn = "{SNS topic ARN for email alerts}"; var AWS = require('aws-sdk'); AWS.config.region_array = topic_arn.split(':'); // splits the ARN

Configure Notifications for RDS or Redshift Maintenance Windows

You can set up event notifications for Amazon RDS and Amazon Redshift clusters and instances so that you receive notifications regarding on-goi

【轉載】Configure the max limit for concurrent TCP connections

轉載地址:http://smallvoid.com/article/winnt-tcpip-max-limit.html To keep the TCP/IP stack from taking all resources on the computer, there are different param

[Cypress] install, configure, and script Cypress for JavaScript web applications -- part1

Despite the fact that Cypress is an application that runs natively on your machine, you can install it and add it as a dependency just like all other depen

[Cypress] install, configure, and script Cypress for JavaScript web applications -- part3

Use custom Cypress command for reusable assertions We’re duplicating quite a few commands between the registration and login of our user for assertions. L

Troubleshoot Email Validation For ACM Certificates

You don't have an MX record. Your domain registrar doesn't support email forwarding.

Get Notifications for Direct Connect Maintenance or Events

Amazon Web Services is Hiring. Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring So

[React] Configure a React & Redux Application For Production Deployment and Deploy to Now

hang scrip app class pack pub relative pts als In this lesson, we’ll make a few small changes to our scripts and add some environme

安裝PHP擴展,提示checking Check for supported PHP versions... configure: error: not supported.

href supported style 提示 shu onf not get targe 頌搶濁吶腥唾韻趁日急感比http://shufang.docin.com/sina_6355808290 傻率行鉀鈉假練笨稭費捎稻http://jz.docin.com/sina_

解決安裝Apache中出現checking for APR... no configure: error: APR not found. Please read the documentation的問題

cef ... clas apr-util 完成 usr 安裝apache make pre Linux中安裝Apache 編譯出現問題: 解決辦法: 1、下載所需要的軟件包 wget http://archive.apache.org/dist/apr/apr-1.4.

Scripts for configure VM

scripts for VMHow to batch extend VM disk Add-PSSnapin vmWARE.VimAutomation.Core $vc="vCenterHostName" connect-viserver $vc $VMinfo = get-content "c:\V

Scripts for configure portgroup

portgroupExport portgroup from the host Add-PSSnapin vmWARE.VimAutomation.Core $vc="Vcname" connect-viserver $vc $date = Get-Date -Format ‘yyyyMMdd‘ $VL

Configure SNMP Settings for vCenter

vCenterConfigure SNMP Settings You can configure up to four receivers to receive SNMP traps from vCenter Server. For each receiver, specify a host name, po

node-pre-gyp ERR! Pre-built binaries not installable for
Configure a proxy for your API calls with Angular CLI

Table of contents Local development setup with Angular Issue: Dev server plus backend API Configuring your Angular CLI dev-server proxy Local de

Unable to resolve dependency for ':
Access denied for user [email protected]

忘記了root密碼,或者刪了root的一些許可權,換來一堆報錯,比如 ERROR 1142 (42000): SELECT command denied to user 'root'@'localhost' for tabERROR 1045 (28000): Access denied for us

mysql Access denied for user [email prot

今天做一個遊戲,伺服器呼叫mysql,查詢使用者名稱密碼,結果怎麼也登入不上mysql,在網上找到一個網友的解決方法,按照他的方式一步一步解決了。 問題重現(以下討論範圍僅限Windows環境):   C:\Users\Administrator> mysql

mysql Access denied for user [email prot

好久沒有使用mysql,突然想起來開啟一個以前的mysql資料庫的專案看看,結果開啟頁面時出錯,提示為:mysql Access denied for user [email protected]錯誤 百度了一下,網上說要改my.ini,於是我到mysql的安裝目錄C:\Program Files

Unable to resolve dependency for ':[email prot

今天匯入Android專案的時候突然遇到了一個問題,‘Unable to resolve dependency’ 有點頭疼,然後就在網上找了很多方法,發現都不行,最後發現,原來是 這個檔案的配置出了錯,我新匯入的gradle-4.6-all.zip,我的專案的是gradle-4.4