特定のIPアドレスからのみ接続を許可する設定をしたく、API Gatewayのリソースポリシーを利用して、ホワイトリスト設定を試したのでその際のメモを残しました。
設定手順
1.API Gateway > APIを選択 > リソースポリシーを選択
2.リソースポリシー欄に以下を記載
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": "< リソース>リソースを選択>メソッドリクエストに記載のARNをコピーして貼り付ける>",
"Condition": {
"IpAddress": {
"aws:SourceIp": "<ここに許可したいIPアドレスを記載>"
}
}
}
]
}
3.保存ボタンをクリック
4. リソース > アクション > APIのデプロイ > デプロイされるステージを選択 > デプロイ