Question 459:
You implement an API in AWS API Gateway. The API integrates with a Lambda Function which returns the query results from an RDS database. For security purposes, you want the API to allow traffic only from a VPC endpoint since it should be used internally. The VPC endpoint ID is vpc-11bb22cc. What is the best method to implement this?
Answer options:
A.Implement the below policy in the API Gateway Resource Policy:
{ "Version": "2012-10-17",
"Statement": [
{ "Effect": "Allow",
"Principal": "vpce-11bb22cc",
"Action": "execute-api:Invoke",
"Resource": [ "arn:aws:execute-api:region:account-id:api-id/*" ]
}
]
}
B.Implement the below policy in the API Gateway Resource Policy:
{ "Version": "2012-10-17",
"Statement": [
{ "Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": [ "arn:aws:execute-api:region:account-id:api-id/*" ]
},
{ "Effect": "Deny",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": [ "arn:aws:execute-api:region:account-id:api-id/*" ],
"Condition" : {
"StringNotEquals": { "aws:SourceVpce": "vpce-11bb22cc" }
}
}
]
}
C.Implement the below policy in the API Gateway Resource Policy:
{ "Version": "2012-10-17",
"Statement": [
{ "Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": [ "arn:aws:execute-api:region:account-id:api-id/*" ],
"Condition" : {
"StringEquals": { "aws:SourceVpce": "vpce-11bb22cc" }
}
}
]
}
D.Implement the below policy in the API Gateway Resource Policy:
{ "Version": "2012-10-17",
"Statement": [
{ "Effect": "Deny",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": [ "arn:aws:execute-api:region:account-id:api-id/*" ]
},
{ "Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": [ "arn:aws:execute-api:region:account-id:api-id/*" ],
"Condition" : {
"StringEquals": { "aws:SourceVpce": "vpce-11bb22cc" }
}
}
]
}