{Redshiftクラスタ}Amazon Redshift イベント通知

-- 1. SNSトピック作成

aws sns list-topics
aws sns list-subscriptions

aws sns create-topic --name topic01

aws sns subscribe --topic-arn arn:aws:sns:ap-northeast-1:999999999999:topic01 --protocol email --notification-endpoint test@example.com


-- 2. クラスター作成
aws redshift create-cluster \
--db-name test \
--cluster-identifier redshift12 \
--cluster-type single-node \
--node-type dc2.large \
--master-username test \
--master-user-password 'password' \
--no-allow-version-upgrade \
--no-publicly-accessible \
--automated-snapshot-retention-period 1

 

-- 3. イベント通知にサブスクライブする

aws redshift create-event-subscription \
--subscription-name subscription01 \
--sns-topic-arn arn:aws:sns:ap-northeast-1:999999999999:topic01 \
--enabled


-- 4. イベント通知サブスクリプションのリスト化
aws redshift describe-event-subscriptions


-- 5. イベント通知サブスクリプションの削除
aws redshift delete-event-subscription --subscription-name subscription01


-- 6. イベント通知カテゴリのリスト化
aws redshift describe-event-categories

-- 7. イベント表示
aws redshift describe-events --duration 60


-- 8. クラスター削除

aws redshift delete-cluster \
--cluster-identifier redshift12 \
--skip-final-cluster-snapshot

-- 9. SNSトピック削除

aws sns unsubscribe --subscription-arn arn:aws:sns:ap-northeast-1:999999999999:topic01:11111111-2222-3333-4444-555555555555
aws sns delete-topic --topic-arn arn:aws:sns:ap-northeast-1:999999999999:topic01

aws sns list-topics
aws sns list-subscriptions