- Newest
- Most votes
- Most comments
To switch your REST API from edge-optimized to regional and attach it to Lambda as a trigger, you'll need to follow these steps:
-
Update your API Gateway configuration: Use the AWS CLI or AWS Management Console to change the endpoint type of your API from edge-optimized to regional. With the AWS CLI, you can use the following command:
aws apigateway update-rest-api \ --rest-api-id your-api-id \ --patch-operations op=replace,path=/endpointConfiguration/types/EDGE,value=REGIONALReplace 'your-api-id' with your actual API ID.
-
Redeploy your API: After changing the endpoint type, you need to redeploy your API to apply the changes.
-
Update your serverless.yml: Modify your serverless.yml file to specify the regional endpoint type. Add the following configuration under the 'provider' section:
provider: apiGateway: endpointType: REGIONAL -
Redeploy your serverless application: Run the serverless deploy command to apply the changes and redeploy your application.
-
Update Lambda trigger: If you've manually set up the Lambda trigger, you may need to update it to point to the new regional endpoint. However, if you're using the Serverless Framework as shown in your configuration, it should handle this automatically.
-
Test your API: After redeployment, test your API to ensure it's working correctly with the new regional endpoint and that the extended timeout is now applied.
Regarding the resource path issue you mentioned, ensure that your serverless.yml configuration for the http event is correct. The "{proxy+}" path should allow for catch-all routing. If you're still experiencing issues, double-check your Lambda function code to ensure it's correctly handling the incoming requests and paths.
Remember that changing the endpoint type may affect your API's behavior and performance, especially if you have geographically distributed users. Consider your use case carefully when deciding between edge-optimized and regional endpoints.
Sources
Change a public or private API endpoint type in API Gateway - Amazon API Gateway
Amazon API Gateway - Serverless Applications Lens
Hi,
To switch your REST API from edge-optimized to regional and attach it to Lambda, here's how to modify your serverless.yml:
# serverless.yml service: your-service provider: name: aws runtime: python3.9 # or your runtime region: us-east-1 # your region functions: rest: handler: rest_handler.handler timeout: 120 events: - http: method: ANY path: /{proxy+} timeoutInMillis: 120000 cors: true endpointType: REGIONAL # Add this line custom: apiGateway: apiType: REGIONAL # Add this section description: 'Regional API Gateway'
Key points:
- Set endpointType to REGIONAL
- Redeploy your service
- Update DNS/CloudFront if needed
- Verify Lambda triggers are correct
For more details:
answered a year ago
Relevant content
asked a year ago

Hello, Thank you for your answer. I am using serverless framework version "4" and there is no endpointType property for rest function: ('functions.rest.events.0.http': unrecognized property 'endpointType')
I added the apiType: REGIONAL but it did not update the gateway to be REGIONAL.