Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Mar 5, 2025

Maintenance ModeYou are viewing Amplify Gen 1 documentation. Amplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027. New project should use Amplify Gen 2. For existing Gen 1 projects, a migration guide and tooling are available to help you upgrade. Switch to the latest Gen 2 docs →

既存のAWSリソースを使用する

既存のAmazon API Gatewayリソースは、API Gateway APIの名前とオプションを参照してAmplify.configure()を呼び出すことで、Amplify Librariesで使用できます。Amplify.configure()を呼び出すときに、完全なリソース設定とライブラリオプションオブジェクトを提供する必要があることに注意してください。次の例は、既存のAmplifyアプリケーションに追加のAPI Gatewayリソースを設定する方法を示しています。

import { Amplify } from 'aws-amplify';
import { parseAmplifyConfig } from "aws-amplify/utils";
import amplifyconfig from './src/amplifyconfiguration.json';
const resourceConfig = parseAmplifyConfig(amplifyconfig);
// Add existing resource to the existing configuration.
Amplify.configure({
...resourceConfig,
API: {
...resourceConfig.API,
REST: {
...resourceConfig.API?.REST,
YourAPIName: {
endpoint:
'https://abcdefghij1234567890.execute-api.us-east-1.amazonaws.com/stageName',
region: 'us-east-1' // Optional
}
}
}
});
  • YourAPIName: APIのフレンドリー名
    • endpoint: APIのHTTPSエンドポイント
    • region: リソースがプロビジョニングされているAWSリージョン。指定されない場合、リージョンはエンドポイントから推測されます。

AWSリソースをアプリケーションに追加する前に、アプリケーションにAmplifyライブラリをインストールしておく必要があります。このステップを実行する必要がある場合は、「Amplify Librariesのインストール」を参照してください。