How to override the restAPI resource to set the endpointConfiguration endpointTypes to Regional from EDGE in AWS Amplify API gateway resource

0

I want to override the restApi resource in override.ts file and set the endpointConfiguration endpointTypes to REGIONAL rather than the default EDGE value that Amplify sets.

I tried doing the following, but it does not seem to be working, and I cannot find the right property to override in override.ts file that I generated using amplify override api.

import { AmplifyApiRestResourceStackTemplate } from "@aws-amplify/cli-extensibility-helper";

export async function override(resources: AmplifyApiRestResourceStackTemplate) {

  resources.restApi.endpointConfiguration.endpointTypes = ["REGIONAL"]

  resources.restApi.addPropertyOverride("endpointConfiguration.endpointTypes", [
    "REGIONAL",
  ]);

  resources.restApi.addPropertyOverride("endpointConfiguration.types", [
    "REGIONAL",
  ]);
}
1 Answer
0
Accepted Answer

Hello,

Warm Greetings!

As per the documentation[1] and [2], EndpointConfiguration property has the type as EndpointConfiguration itself which in return is a list. Hence, tried the below code in overrides.ts file :

======================

import { AmplifyApiRestResourceStackTemplate, AmplifyProjectInfo } from '@aws-amplify/cli-extensibility-helper';

export function override(resources: AmplifyApiRestResourceStackTemplate, amplifyProjectInfo: AmplifyProjectInfo) {

// Change the endpoint type
resources.restApi.endpointConfiguration = { types :["REGIONAL"] };

}

Hope the information provided above is helpful.

Additionally, for resource level troubleshooting, I would request you to raise a premium support case and a Support Engineer can look into the override.ts file configuration in question.

[+] https://console.aws.amazon.com/support/home#/case/create

Have a nice day!

References: [1]https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-restapi.html#cfn-apigateway-restapi-endpointconfiguration

[2]https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-restapi-endpointconfiguration.html

AWS
answered 2 years 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