Page updated Nov 9, 2023

Use existing AWS resources

Existing Amazon API Gateway resources can be used with the Amplify Libraries by calling Amplify.configure() with the API Gateway API name and options. Note you need to supply the full resource configuration and library options objects when calling Amplify.configure(). The following example shows how to configure additional API Gateway resources to an existing Amplify application:

const existingConfig = Amplify.getConfig(); Amplify.configure({ ...existingConfig, API: { ...existingConfig.API, REST: { ...existingConfig.API?.REST, '[API NAME]': { endpoint: '[API GATEWAY ENDPOINT]', region: '[REGION]' } } } });
1const existingConfig = Amplify.getConfig();
3 ...existingConfig,
4 API: {
5 ...existingConfig.API,
6 REST: {
7 ...existingConfig.API?.REST,
8 '[API NAME]': {
9 endpoint: '[API GATEWAY ENDPOINT]',
10 region: '[REGION]'
11 }
12 }
13 }
  • API NAME: Friendly name for the API (e.g., api)

Note that before you can add an AWS resource to your application, the application must have the Amplify libraries installed. If you need to perform this step, see Install Amplify Libraries.