การคืนการตั้งค่าของ Secure Account: วิธีปิดการแจ้งเตือนของ Amazon Eventbridge
สวัสดีครับ ท่านผู้อ่านทุกท่าน ผมกาญจน์ครับ เรามาพบกันอีกครั้งกับสาระดีๆเกี่ยวกับ Secure Account อีกครั้งครับ
ในบทความนี้ จะมาแนะนำขั้นตอนการปิดการใช้งานการตั้งค่าความปลอดภัยของ Amazon EventBridge ที่เกิดขึ้นจากการเปิดใช้บริการ Secure Account ที่ Classmethod Members มอบให้ครับ
บทความนี้แปลมาจากบทความภาษาญี่ปุ่นที่ชื่อว่า【セキュアアカウント切り戻し手順】Amazon EventBridge通知設定の無効化手順のご案内 โดยเจ้าของบทความนี้คือ คุณ โคเฮ
ในบทความนี้ เราจะแนะนำขั้นตอนการปิดการตั้งค่าการแจ้งเตือนของ Amazon EventBridge ในบริการ Secure Account ที่ Classmethod Members มอบให้
Secure Account คืออะไร
ที่ Classmethod เรามีการให้บริการบัญชี AWS ที่มีการติดตั้งด้านความปลอดภัยอย่างครบถ้วนตามแนวทาง Best practice แก่ลูกค้าของเรา
คุณลูกค้าที่ใช้บริการบัญชี AWS ผ่าน Classmethod ทุกท่านสามารถใช้บริการนี้ได้ จึงอยากเชิญชวนให้มาใช้กันครับ
สถาปัตยกรรมของ Secure Account
Secure Account มีการตั้งค่าดังต่อไปนี้
สำหรับรายละเอียดของแต่ละการตั้งค่า สามารถอ้างอิงบทความข้างล่างหรือเอกสารในลิงค์นี้ได้ครับ
บริการที่เป็นเป้าหมายในการปิดการใช้งานครั้งนี้

ในครั้งนี้จะแนะนำขั้นตอนการปิดการใช้งานการตั้งค่าการแจ้งเตือน Amazon EventBridge ที่เปิดใช้งานใน Secure Account กันครับ
การตั้งค่าการแจ้งเตือนของ Amazon EventBridge
ใน Secure Account มีการเปิดใช้งานบริการด้านความปลอดภัย (โดยเฉพาะ GuardDuty, Security Hub และ IAM Access Analyzer) ที่สามารถตรวจจับภัยคุกคาม (Threat) ภายในบัญชี แต่ในสถานะเริ่มต้น ภัยคุกคามเหล่านี้จะแสดงเฉพาะภายในบัญชีเท่านั้น
ผู้ใช้จะไม่ทราบถึงภัยคุกคามเหล่านี้จนกว่าจะเข้าสู่ระบบบัญชี ซึ่งจำเป็นต้องค้นหาและจัดการกับภัยคุกคามได้ทันที

เมื่อเปิดใช้งานการตั้งค่านี้ คุณจะสามารถรับการแจ้งเตือนการตรวจจับเหตุการณ์ต่างๆ ทางอีเมลได้ ทำให้สามารถดำเนินการตอบสนองได้อย่างรวดเร็ว

สำหรับการตั้งค่าให้ส่งการแจ้งเตือนไปยังอีเมล์ สามารถดูวิธีการได้ตามลิงค์ข้างล่างนี้ครับ
ค่าบริการ
1. ข้อกำหนดเบื้องต้น
1.1 การปิดใช้งานบริการ (Opt-in) ผ่าน Classmethod Members Portal (CMP)
ในระบบ Secure Account เราจะต้องไปที่เว็บไซต์ Classmethod Members Portal (CMP) เพื่อทำการปิดการใช้งาน Opt-in
หากไม่ปิดการใช้งานในส่วนนี้ ในทุกๆวันเสาร์ Classmethod Members Portal จะทำการเปิดบริการดังกล่าวขึ้นมาใหม่โดยอัตโนมัติถึงแม้เราจะปิดการใช้งาน ใน Console ไปแล้ว ฉะนั้น หากต้องการจะปิดการใช้บริการไหน เราต้องปิด Opt-in ในเว็บไซต์ Classmethod Members Portal ก่อนครับ
- อันดับแรก ให้มาที่เว็บไซต์ Classmethod Members Portal จากหัวข้อ "AWS Account" แล้วเลือก Account ID ที่เราต้องการครับ
- จากนั้นเลื่อนลงมาที่หัวข้อ "Security Settings" แล้วคลิกที่ Edit
- หลังจากนั้น ให้เลื่อนลงมาที่ "Secure Settings" แล้วติ๊ก "Amazon EventBridge Notification" ออก

4. จากนั้นเลื่อนลงมาข้างล่างสุดแล้วกด "Save" เพื่อบันทึกการเปลี่ยนแปลงครับ

2. ขั้นตอนการปิดการใช้งาน
-
ถ้าผู้อ่านจะทำการตั้งค่าการแจ้งเตือนผ่านอีเมลโดยอ้างอิงจากบทความนี้หรือจากคู่มือผู้ใช้งาน(ที่อยู่ข้อ 3.3.9. Amazon EventBridge) เราจำเป็นจะต้องลบ Resource ที่เกี่ยวข้องกับการแจ้งเตือน (notification) ก่อนล่วงหน้าครับ
-
Resource ที่เราจะลบต่อไปนี้เป็นรายการ Resource เดียวกันกับในคู่มือผู้ใช้งาน ในหัวข้อ 3.3.9 Amazon EventBridge ครับ
Resource ที่จะลบ:
- IAM Role
- cm-alert-eventrule-role
- cm-alert-forward-eventrule-role
- cm-alert-statemachine-role
- AWS Step Functions State Machine
- cm-sharping-security-alert-machine (Singapore Region)
- Event Rule
- cm-securityhub-alert-rule (Singapore Region)
- cm-guardduty-alert-rule (Singapore Region)
- cm-accessanalyzer-alert-rule (Singapore Region)
- cm-guardduty--alert-rule (Region อื่นๆนอกจาก Singapore Region)
- cm-accessanalyzer--alert-rule (Region อื่นๆนอกจาก Singapore Region)
- Event Bus
- cm-security-alert-aggregator-bus (Singapore Region)
Resource ที่จะลบจาก CloudFormation
- AWS Step Functions State Machine
- cm-security-alert-aggregator-bus (Singapore Region)
- Event Rule
- cm-security-alert-mail(slack)-rule (Singapore Region)
- SNS
- Topic
- cm-security-alert-mail-topic (Singapore Region)
- Subscription
- อีเมลที่ลงทะเบียนไว้ (Singapore Region)
2.1 การลบ Event Bus
เปิด CloudShell และรันคำสั่งต่อไปนี้ (สามารถดูการใช้ Cloudshell ได้ตามลิงค์นี้ครับ)
Note: เนื่องจากปัจจุบัน บริการ Cloudshell จะยังไม่มีใน Thailand Region ครับ หากผู้อ่านจะใช้ Cloudshell จำเป็นต้องเปลี่ยนไปใช้ที่ Singapore Region ก่อนครับ
aws events delete-event-bus --name cm-security-alert-aggregator-bus --region ap-southeast-1
การใช้คำสั่งตามด้านบนจะเป็นการลบ Resource ตามรายการด้านล่าง
- Event Bus
- cm-security-alert-aggregator-bus (Singapore Region)
2.2 การลบ Event Rule
aws events list-targets-by-rule --rule cm-securityhub-alert-rule --region ap-southeast-1 \
| jq -r '.Targets[].Id' \
| while read -r TARGET_ID
do
aws events remove-targets --rule cm-securityhub-alert-rule --region ap-southeast-1 --ids "$TARGET_ID"
aws events delete-rule --name cm-securityhub-alert-rule --region ap-southeast-1
done
aws events list-targets-by-rule --rule cm-guardduty-alert-rule --region ap-southeast-1 \
| jq -r '.Targets[].Id' \
| while read -r TARGET_ID
do
aws events remove-targets --rule cm-guardduty-alert-rule --region ap-southeast-1 --ids "$TARGET_ID"
aws events delete-rule --name cm-guardduty-alert-rule --region ap-southeast-1
done
aws events list-targets-by-rule --rule cm-accessanalyzer-alert-rule --region ap-southeast-1 \
| jq -r '.Targets[].Id' \
| while read -r TARGET_ID
do
aws events remove-targets --rule cm-accessanalyzer-alert-rule --region ap-southeast-1 --ids "$TARGET_ID"
aws events delete-rule --name cm-accessanalyzer-alert-rule --region ap-southeast-1
done
การใช้คำสั่งตามด้านบนจะเป็นการลบ Resource ตามรายการด้านล่าง
- Event Rule
- cm-securityhub-alert-rule (Singapore Region)
- cm-guardduty-alert-rule (Singapore Region)
- cm-accessanalyzer-alert-rule (Singapore Region)
aws ec2 describe-regions --query 'Regions[?RegionName!=`ap-southeast-1`].RegionName' | jq -r '.[]' \
| while read -r REGION
do
# Delete targets related to an event rule
aws events list-targets-by-rule --rule "cm-guardduty-${REGION}-alert-rule" --region "${REGION}" \
| jq -r '.Targets[].Id' \
| while read -r TARGET_ID
do
aws events remove-targets --rule "cm-guardduty-${REGION}-alert-rule" --region "${REGION}" --ids "$TARGET_ID"
aws events delete-rule --name "cm-guardduty-${REGION}-alert-rule" --region "${REGION}"
done
aws events list-targets-by-rule --rule "cm-accessanalyzer-${REGION}-alert-rule" --region "${REGION}" \
| jq -r '.Targets[].Id' \
| while read -r TARGET_ID
do
aws events remove-targets --rule "cm-accessanalyzer-${REGION}-alert-rule" --region "${REGION}" --ids "$TARGET_ID"
aws events delete-rule --name "cm-accessanalyzer-${REGION}-alert-rule" --region "${REGION}"
done
done
การใช้คำสั่งตามด้านบนจะเป็นการลบ Resource ตามรายการด้านล่าง
- Event Rule
- cm-guardduty--alert-rule (Region อื่นๆนอกจาก Singapore Region)
- cm-accessanalyzer--alert-rule (Region อื่นๆนอกจาก Singapore Region)
2.3 การลบ AWS Step Functions State Machine
aws stepfunctions list-state-machines --region ap-southeast-1 --query "stateMachines[?name=='cm-sharping-security-alert-machine'].stateMachineArn" | jq -r '.[]' \
| while read -r STATE_MACHINE_ARN
do
aws stepfunctions delete-state-machine --state-machine-arn "$STATE_MACHINE_ARN" --region ap-southeast-1
done
การใช้คำสั่งตามด้านบนจะเป็นการลบ Resource ตามรายการด้านล่าง
- AWS Step Functions State Machine
- cm-sharping-security-alert-machine (Singapore Region)
2.4 การลบ IAM Role
aws iam delete-role-policy --role-name cm-alert-eventrule-role --policy-name cm-alert-eventrule-policy
aws iam delete-role --role-name cm-alert-eventrule-role
aws iam delete-role-policy --role-name cm-alert-forward-eventrule-role --policy-name cm-alert-forward-eventrule-policy
aws iam delete-role --role-name cm-alert-forward-eventrule-role
aws iam delete-role-policy --role-name cm-alert-statemachine-role --policy-name cm-alert-statemachine-policy
aws iam delete-role --role-name cm-alert-statemachine-role
การใช้คำสั่งตามด้านบนจะเป็นการลบ Resource ตามรายการด้านล่าง
- IAM Role
- cm-alert-eventrule-role
- cm-alert-forward-eventrule-role
- cm-alert-statemachine-role
2.5 การลบ Resource ที่จัดเตรียมโดย CloudFormation
- AWS Step Functions State Machine
- cm-security-alert-aggregator-bus (Singapore Region)
- Event Rule
- cm-security-alert-mail(slack)-rule (Singapore Region)
- SNS
- Topic
- cm-security-alert-mail-topic (Singapore Region)
- Subscription
- อีเมลที่ลงทะเบียนไว้ (Singapore Region)
สำหรับ Resource ข้างต้น โปรดดูที่ 6. กรณีอยากลบ Resource ที่เกี่ยวกับการแจ้งเตือนทั้งหมด
3. หากต้องการเปิดการใช้งานอีกครั้ง
- ให้มาที่เว็บไซต์ Classmethod Members Portal จากหัวข้อ "AWS Account" แล้วเลือก Account ID ที่เราต้องการครับ
- จากนั้นเลื่อนลงมาที่หัวข้อ "Security Settings" แล้วคลิกที่ Edit
- ที่หัวข้อ "Secure Settings" ให้ติ๊กเปิดการใช้งาน "Amazon EventBridge Notification" อีกครั้ง
-
จากนั้นเลื่อนลงมาข้างล่างสุดแล้วกด "Save" เพื่อบันทึกการเปลี่ยนแปลงครับ

-
การเปิดใช้งาน EventBridge ก็จะเสี็จสมบูรณ์ครับ
ทิ้งท้าย
จบไปแล้วครับกับบทความ "การคืนการตั้งค่าของ Secure Account: วิธีปิดการแจ้งเตือนของ Amazon Eventbridge" หวังว่าผู้อ่านทุกท่านจะได้ประโยชน์และเข้าใจเกี่ยวกับการเปิดปิดการใช้ EventBridge ใน Secure Account มากขึ้นนะครับ
แล้วพบกันใหม่ในบทความหน้า สวัสดีครับ
บทความต้นฉบับ
【セキュアアカウント切り戻し手順】Amazon EventBridge通知設定の無効化手順のご案内(บทความภาษาญี่ปุ่น)










