アカウントを跨いで共有されたAuroraのスナップショットをAWS CLI上で復元させるコマンドが知りたい

0

これはなに

AWSアカウントAからアカウントBに対し、アカウントを跨いで共有されたAuroraのスナップショットをAWS CLI上で復元させようとしたところ、db-cluster-snapshot-identifierはアカウントを跨いだ場合一意でない為に設定されません。したがって、aws rds restore-db-cluster-from-snapshotするときに指定できず困っております。これをどうしたらAWS CLIから実現できるのか知りたいです。

どうしたの

まずはじめに、AWS CLI上で以下のコマンドを実行しスナップショットの共有をアカウントAからアカウントBに向けて実行し、Auroraスナップショットの共有を行いました。

aws rds modify-db-cluster-snapshot-attribute \
  --db-cluster-snapshot-identifier [スナップショットのID] \
  --attribute-name restore \
  --values-to-add [共有先のAWSアカウント]

そうしたところ、共有されたスナップショットは以下のように表示され DB スナップショット名:該当なし となっており以下のコマンドを使い復元させることができません

aws rds restore-db-cluster-from-snapshot \
  --availability-zones ap-northeast-1d \
  --db-cluster-identifier [クラスターのID]  \
  --snapshot-identifier [指定できない]  \
  --engine aurora-mysql  \
  --port 3306 \
  --db-subnet-group-name [グループの名前] \
  --database-name [データベース名]

Enter image description here

profile picture
asked a year ago324 views
2 Answers
0
Accepted Answer

アカウントBの方で

aws rds describe-db-cluster-snapshots --include-shared

の結果から該当のスナップショットのDBClusterSnapshotIdentifierを確認するのはどうでしょうか。

AWS
nog
answered a year ago
0

回答ありがとうございます。db-cluster-snapshot-identifierは初期値では設定されていませんが、代わりにARNを--snapshot-identifierに設定するという方法でこちら解決しました。以下みたいな形で設定しました。

aws rds restore-db-cluster-from-snapshot \
  --availability-zones ap-northeast-1d \
  --db-cluster-identifier [クラスターのID]  \
  --snapshot-identifier [スナップショットのARN]  \
  --engine aurora-mysql  \
  --port 3306 \
  --db-subnet-group-name [グループの名前] \
  --database-name [データベース名]
profile picture
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions