[AWS] health status ๊ตฌ๋ ํ๊ธฐ
AWS๋ ์ฌํ ์ธํ๋ผ ์๋น์ค๋ค๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก ํฌ์ค์ฒดํฌ์ฉ ์ฝ์์ ์ ๊ณตํ๋ค.
์๋ ๋งํฌ์ ๋ค์ด๊ฐ๋ฉด ๊ธ๋ก๋ฒ ์ฅ์ ๋ ์
๋ฐ์ดํธ, ํน์ ๋ด ๊ณ์ ์์ ๋ฐ์ํ ํน์ํ ์ด๋ฒคํธ๋ฅผ ํ์ธํ ์ ์๋ค.
https://health.aws.amazon.com/health/status
๊ฐ๋ ๋ค์ด๊ฐ์ ๋ญ์ผ ์๋ ํ์ธํด๋ณด๋ฉด ๋๋ค.
๊ทผ๋ฐ ์ด๊ฑธ ๋งค๋ฒ ๋ค์ด๊ฐ์ ๋ณด๋ ๊ฒ๋ ์ผ์ด๊ณ , ์ ๋๋ก ํ์ฉ์ ํ๋ ค๋ฉด ์๋ฆผ์ด ์ค๊ฒ ํ๋ ํธ์ด ์ข๋ค.
AWS๋ ์ด๊ฑฐ์ ๋ํ ๋ญ๊ฐ ๊ตฌ๋
์ฒด๊ณ๊ฐ ์ฉ ์ ๋์ด์์ง๋ ์์์ ์ง์ ๊ตฌํ์ ํด์ค์ผ ํ๋ค.
GCP๊ฐ RSS ํผ๋ ํํ๋ก ๊ตฌ๋
๋ฐ์ดํฐ๋ฅผ ์ ๊ณตํ๋ ๊ฒ๊ณผ ์๋ฐ๋๋ค.
aws ์ํ ์๋ฆผ์ aws ์์ฒด์ ์ด๋ฒคํธ๋ก ์์ ์ด ๊ฐ๋ฅํ๋ค.
๊ทธ๋์ eventbridge๋ฅผ ํตํด ์ ์ดํ ์ ์๋ค.
Slack ๊ตฌ๋ ์์คํ ๊ตฌํ
๋๋ ์ฌ๋ ์นํ
์ ์ฌ์ฉํด์ ์ง์ ์ฌ๋ ํตํฉ์ ๊ตฌํํ๋ค.
Lambda ํ๋ ํ๊ณ , ์ ๋นํ ๋ค์๊ณผ ๊ฐ์ด ๊ตฌํํ๋ค.

const axios = require('axios');
// ์ฌ๋ ์นํ
๋งํฌ
const SLACK_URL = `https://hooks.slack.com/services/...`;
exports.handler = async (event) => {
console.log(event);
const detail = event?.detail;
const status = detail?.statusCode;
const region = event?.region;
const service = detail?.service
const description = detail?.eventDescription?.[0]?.latestDescription;
const attachments = [
{
"color": "#ff0000",
"pretext": "AWS ์ํ ์๋ฆผ",
"title": "Status ์ฝ์ ์ด๋",
"title_link": "https://health.aws.amazon.com/health/status",
"text": "AWS ์ํ ์๋ฆผ",
"fields": [
{
"title": "์ํ",
"value": status,
"short": false
},
{
"title": "์๋น์ค",
"value": service,
"short": false
},
{
"title": "๋ฆฌ์ ",
"value": region,
"short": false
},
{
"title": "๋ด์ฉ",
"value": description,
"short": false
},
],
}
];
await axios.post(SLACK_URL, {
username: 'Amazon Cloud Service Health Updates',
attachments,
channel: '์ฑ๋ID',
});
// TODO implement
const response = {
statusCode: 200,
body: JSON.stringify('Hello from Lambda!'),
};
return response;
};
๋ฐ์์ ์ ๋นํ ํ์ฑํ๊ณ ์ฌ๋์ ์ด์ฃผ๋ ๋ก์ง์ด๋ค.
๊ทธ๋ฆฌ๊ณ eventbridge ๊ท์น์ผ๋ก ํธ๋ฆฌ๊ฑฐ๋ฅผ ๊ฑธ์ด์ค๋ค.


์์ค๋ aws.health๋ฉด ๋๋ค.

๊ทธ๋ฆฌ๊ณ ๋ฐฉ๊ธ ๋ง๋ ๋๋ค๋ฅผ ๊ฑธ์ด์ฃผ๋ฉด ๋์ด๋ค.

์ด๊ฒ ์ด๋ฒคํธ ๋ฐํ์๊ฐ ๋ด๊ฐ ์๋๋ผ aws๋ผ์ ์ค์ ํ
์คํธ๋ ์ด๋ ต๋ค.
๋ง์ฝ ์์ ์ฝ๋๋ฅผ ๊ฐ์ ธ๋ค ๋ง๋ค์์ผ๋ฉด ์ด๋ ๊ฒ ๋ฐ ๊ฒ์ด๋ค.
๋๋ ์ ์ฐ๊ณ ์๋ค.