Reputation: 43
How to I define a specific API Gateway endpoint configuration for this stack? I receive the following error when deploying the API gateway resource (apigw.LambdaRestApi): Endpoint Configuration type EDGE is not supported in this region: us-gov-west-1. I found information on the endpointConfiguration property to change the endpoint type, but am struggling with how to define this to update the code successfully. Any help would be greatly appreciated.
from aws_cdk import (
core,
aws_lambda as _lambda,
aws_apigateway as apigw,
)
class CdkworkshopStack(core.Stack):
def __init__(self, scope: core.Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
# Define Lambda Resource
my_lambda = _lambda.Function(
self, 'HelloHandler',
runtime=_lambda.Runtime.PYTHON_3_7,
code=_lambda.Code.asset('lambda'),
handler='hello.handler',
)
apigw.LambdaRestApi(
self, 'Endpoint',
handler=my_lambda,
)
Upvotes: 1
Views: 661
Reputation: 540
So just to be clear, you don't want EDGE type endpoint configuration? You want REGIONAL, or perhaps PRIVATE?
https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_apigateway/LambdaRestApi.html
Judging by this I think you might just do:
apigw.LambdaRestApi(
self, 'Endpoint',
handler=my_lambda,
endpoint_configuration=EndpointType.REGIONAL
)
Upvotes: 2