無限ノック › DVA 練習問題一覧 › 問題
DVAAWSのサービスを使用した開発

開発チームはイベント駆動型アーキテクチャを採用し、EC2インスタンスの状態が「stopped」に変化したときにAmazon EventBridgeを通じてLambda関数を自動的に実行し、停止したインスタンスのIDをDynamoDBに記録したいと考えています。EventBridgeルールに設定するイベントパターン(JSONフォーマット)として正しいものはどれですか?

A
{ "source": ["aws.ec2"], "detail-type": ["EC2 Instance State-change Notification"], "detail": { "state": ["stopped"] } }
✓ 正解
EventBridgeのEC2インスタンス状態変化イベントでは、sourceは"aws.ec2"("ec2.amazonaws.com"はIAMイベント用)、フィールド名は"detail-type"("event-type"は存在しない)、detail内のstateで状態をフィルタリングします。
B
{ "source": ["ec2.amazonaws.com"], "detail-type": ["EC2 State Change"], "detail": { "status": ["stopped"] } }
{ "source": ["ec2.amazonaws.com"], "detail-type": ["EC2 State Change"], "detail": { "status": ["stopped"] } }は、sourceが"ec2.amazonaws.com"(IAMイベント用)であり不適切です。
C
{ "resources": ["arn:aws:ec2:*"], "detail-type": ["EC2 Instance State-change Notification"], "detail": { "state": ["stopped"] } }
{ "resources": ["arn:aws:ec2:*"], "detail-type": ["EC2 Instance State-change Notification"], "detail": { "state": ["stopped"] } }は、resourcesフィールドでのフィルタリングはsourceとdetail-typeの組み合わせより劣ります。
D
{ "source": ["aws.ec2"], "event-type": ["EC2 Instance State-change Notification"], "detail": { "state": ["stopped"] } }
{ "source": ["aws.ec2"], "event-type": ["EC2 Instance State-change Notification"], "detail": { "state": ["stopped"] } }は、フィールド名が"event-type"となっており、正しくは"detail-type"です。

解説

EventBridgeのEC2インスタンス状態変化イベントでは、sourceは"aws.ec2"("ec2.amazonaws.com"はIAMイベント用)、フィールド名は"detail-type"("event-type"は存在しない)、detail内のstateで状態をフィルタリングします。 選択肢Bの{ "source": ["ec2.amazonaws.com"], "detail-type": ["EC2 State Change"], "detail": { "status": ["stopped"] } }は、sourceが"ec2.amazonaws.com"(IAMイベント用)であり不適切です。 選択肢Cの{ "resources": ["arn:aws:ec2:*"], "detail-type": ["EC2 Instance State-change Notification"], "detail": { "state": ["stopped"] } }は、resourcesフィールドでのフィルタリングはsourceとdetail-typeの組み合わせより劣ります。 選択肢Dの{ "source": ["aws.ec2"], "event-type": ["EC2 Instance State-change Notification"], "detail": { "state": ["stopped"] } }は、フィールド名が"event-type"となっており、正しくは"detail-type"です。

ドメイン別正答率・予想スコアでリアルタイムに実力把握

無限ノックでDVAを徹底対策。全問AI生成のオリジナル問題。

無料で演習を始める →
← DVA の問題一覧に戻る