ハンズオン(簡易版): EventBridge入門

事前作業1. EventBridge スキーマの確認

目的

EventBridge スキーマ"aws.ec2@EBSVolumeNotification"の内容を確認します。

パラメータの指定

作業に必要なパラメータを変数に格納をします。

0. リージョンの指定

リージョンを指定します。

環境変数の設定

export AWS_DEFAULT_REGION='ap-northeast-1'

1. EventBridge スキーマレジストリ名

EventBridge スキーマレジストリ名を指定します。

変数の設定:

SCHEMAS_REGISTRY_NAME="aws.events"

2. EventBridge スキーマ名

EventBridge スキーマ名を指定します。

変数の設定:

SCHEMAS_SCHEMA_NAME="aws.ec2@EBSVolumeNotification"

各変数に正しいパラメータ値が格納されていることを確認します。

変数の確認:

cat << END

  # 0. AWS_DEFAULT_REGION:"ap-northeast-1"
       AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION}"

  # 1. SCHEMAS_REGISTRY_NAME:"aws.events"
       SCHEMAS_REGISTRY_NAME="${SCHEMAS_REGISTRY_NAME}"
  # 2. SCHEMAS_SCHEMA_NAME:"aws.ec2@EBSVolumeNotification"
       SCHEMAS_SCHEMA_NAME="${SCHEMAS_SCHEMA_NAME}"

END

手順

EventBridge スキームを取得します。

コマンド:

aws schemas describe-schema \
  --registry-name ${SCHEMAS_REGISTRY_NAME} \
  --schema-name ${SCHEMAS_SCHEMA_NAME}

結果(例):

{
  "Content": "{ \"openapi\" : \"3.0.0\", \"info\" : { \"version\" : \"1.0.0\", \"title\" : \"EBSVolumeNotification\" }, \"paths\" : { }, \"components\" : { \"schemas\" : { \"AWSEvent\" : { \"type\" : \"object\", \"required\" : [ \"detail-type\", \"resources\", \"id\", \"source\", \"time\", \"detail\", \"region\", \"version\", \"account\" ], \"x-amazon-events-detail-type\" : \"EBS Volume Notification\", \"x-amazon-events-source\" : \"aws.ec2\", \"properties\" : { \"detail\" : { \"$ref\" : \"#/components/schemas/EBSVolumeNotification\" }, \"detail-type\" : { \"type\" : \"string\" }, \"resources\" : { \"type\" : \"array\", \"items\" : { \"type\" : \"string\" } }, \"id\" : { \"type\" : \"string\" }, \"source\" : { \"type\" : \"string\" }, \"time\" : { \"type\" : \"string\", \"format\" : \"date-time\" }, \"region\" : { \"type\" : \"string\" }, \"version\" : { \"type\" : \"string\" }, \"account\" : { \"type\" : \"string\" } } }, \"EBSVolumeNotification\" : { \"type\" : \"object\", \"required\" : [ \"result\", \"cause\", \"event\", \"request-id\" ], \"properties\" : { \"result\" : { \"type\" : \"string\" }, \"cause\" : { \"type\" : \"string\" }, \"event\" : { \"type\" : \"string\" }, \"request-id\" : { \"type\" : \"string\" } } } } } }",
  "Description": "Schema for event type EBSVolumeNotification, published by AWS service aws.ec2",
  "LastModified": "2019-12-01T00:31:47Z",
  "SchemaArn": "",
  "SchemaName": "aws.ec2@EBSVolumeNotification",
  "SchemaVersion": "1",
  "Tags": {},
  "Type": "OpenApi3",
  "VersionCreatedDate": "2019-12-01T00:31:47Z"
}

完了確認

「EventBridge スキーマ"aws.ec2@EBSVolumeNotification"の内容を確認できている。」ことを確認します。