

# AWS CLI を使用した API Gateway の例
<a name="cli_api-gateway_code_examples"></a>

次のコードサンプルは、API Gateway で AWS Command Line Interface を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています。

*アクション*はより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

各例には完全なソースコードへのリンクが含まれており、コードの設定方法と実行方法に関する手順を確認できます。

**Topics**
+ [アクション](#actions)

## アクション
<a name="actions"></a>

### `create-api-key`
<a name="api-gateway_CreateApiKey_cli_topic"></a>

次のコード例では、`create-api-key` を使用する方法を示しています。

**AWS CLI**  
**既存の API とステージで有効になっている API キーを作成する方法**  
コマンド:  

```
aws apigateway create-api-key --name 'Dev API Key' --description 'Used for development' --enabled --stage-keys restApiId='a1b2c3d4e5',stageName='dev'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateApiKey](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-api-key.html)」を参照してください。

### `create-authorizer`
<a name="api-gateway_CreateAuthorizer_cli_topic"></a>

次のコード例では、`create-authorizer` を使用する方法を示しています。

**AWS CLI**  
**例 1: API のトークンベースの API Gateway Custom Authorizer を作成する方法**  
次の `create-authorizer` の例では、トークンベースのオーソライザーを作成します。  

```
aws apigateway create-authorizer \
    --rest-api-id 1234123412 \
    --name 'First_Token_Custom_Authorizer' \
    --type TOKEN \
    --authorizer-uri 'arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:customAuthFunction/invocations' \
    --identity-source 'method.request.header.Authorization' \
    --authorizer-result-ttl-in-seconds 300
```
出力:  

```
{
    "authType": "custom",
    "name": "First_Token_Custom_Authorizer",
    "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:customAuthFunction/invocations",
    "authorizerResultTtlInSeconds": 300,
    "identitySource": "method.request.header.Authorization",
    "type": "TOKEN",
    "id": "z40xj0"
}
```
**例 2: API の Cognito ユーザープールベースの API Gateway Custom Authorizer を作成する方法**  
次の `create-authorizer` の例では、Cognito ユーザープールベースの API Gateway Custom Authorizer を作成します。  

```
aws apigateway create-authorizer \
    --rest-api-id 1234123412 \
    --name 'First_Cognito_Custom_Authorizer' \
    --type COGNITO_USER_POOLS \
    --provider-arns 'arn:aws:cognito-idp:us-east-1:123412341234:userpool/us-east-1_aWcZeQbuD' \
    --identity-source 'method.request.header.Authorization'
```
出力:  

```
{
    "authType": "cognito_user_pools",
    "identitySource": "method.request.header.Authorization",
    "name": "First_Cognito_Custom_Authorizer",
    "providerARNs": [
        "arn:aws:cognito-idp:us-east-1:342398297714:userpool/us-east-1_qWbZzQhzE"
    ],
    "type": "COGNITO_USER_POOLS",
    "id": "5yid1t"
}
```
**例 3: API のリクエストベースの API Gateway Custom Authorizer を作成する方法**  
次の `create-authorizer` の例では、リクエストベースのオーソライザーを作成します。  

```
aws apigateway create-authorizer \
    --rest-api-id 1234123412 \
    --name 'First_Request_Custom_Authorizer' \
    --type REQUEST \
    --authorizer-uri 'arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:customAuthFunction/invocations' \
    --identity-source 'method.request.header.Authorization,context.accountId' \
    --authorizer-result-ttl-in-seconds 300
```
出力:  

```
{
    "id": "z40xj0",
    "name": "First_Request_Custom_Authorizer",
    "type": "REQUEST",
    "authType": "custom",
    "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:customAuthFunction/invocations",
    "identitySource": "method.request.header.Authorization,context.accountId",
    "authorizerResultTtlInSeconds": 300
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-authorizer.html)」を参照してください。

### `create-base-path-mapping`
<a name="api-gateway_CreateBasePathMapping_cli_topic"></a>

次のコード例では、`create-base-path-mapping` を使用する方法を示しています。

**AWS CLI**  
**カスタムドメイン名のベースパスマッピングを取得する方法**  
コマンド:  

```
aws apigateway create-base-path-mapping --domain-name subdomain.domain.tld --rest-api-id 1234123412 --stage prod --base-path v1
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateBasePathMapping](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-base-path-mapping.html)」を参照してください。

### `create-deployment`
<a name="api-gateway_CreateDeployment_cli_topic"></a>

次のコード例では、`create-deployment` を使用する方法を示しています。

**AWS CLI**  
**API に設定したリソースを新しいステージにデプロイする方法**  
コマンド:  

```
aws apigateway create-deployment --rest-api-id 1234123412 --stage-name dev --stage-description 'Development Stage' --description 'First deployment to the dev stage'
```
**API に設定したリソースを既存のステージにデプロイする方法**  
コマンド:  

```
aws apigateway create-deployment --rest-api-id 1234123412 --stage-name dev --description 'Second deployment to the dev stage'
```
**ステージ変数を使用して、API に設定したリソースを既存のステージにデプロイする方法**  
aws apigateway create-deployment --rest-api-id 1234123412 --stage-name dev --description 'Third deployment to the dev stage' --variables key='value',otherKey='otherValue'  
+  API の詳細については、AWS CLI コマンドリファレンスの「[CreateDeployment](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-deployment.html)」を参照してください。**

### `create-domain-name-access-association`
<a name="api-gateway_CreateDomainNameAccessAssociation_cli_topic"></a>

次のコード例は、`create-domain-name-access-association` を使用する方法を示しています。

**AWS CLI**  
**ドメイン名アクセスの関連付けを作成するには**  
次の `create-domain-name-access-association` の例では、プライベートカスタムドメイン名と VPC エンドポイントとの間にドメイン名アクセスの関連付けを作成します。  

```
aws apigateway create-domain-name-access-association \
    --domain-name-arn arn:aws:apigateway:us-west-2:111122223333:/domainnames/my.private.domain.tld+abcd1234 \
    --access-association-source vpce-abcd1234efg \
    --access-association-source-type VPCE
```
出力:  

```
{
    "domainNameAccessAssociationArn": "arn:aws:apigateway:us-west-2:012345678910:/domainnameaccessassociations/domainname/my.private.domain.tld/vpcesource/vpce-abcd1234efg
    "accessAssociationSource": "vpce-abcd1234efg",
    "accessAssociationSourceType": "VPCE",
    "domainNameArn" : "arn:aws:apigateway:us-west-2:111122223333:/domainnames/private.example.com+abcd1234"
}
```
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのプライベート API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-custom-domains.html)」を参照してください。  
+  API の詳細については、*AWS CLI コマンドリファレンス*の「[CreateDomainNameAccessAssociation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-domain-name-access-association.html)」を参照してください。

### `create-domain-name`
<a name="api-gateway_CreateDomainName_cli_topic"></a>

次のコード例は、`create-domain-name` を使用する方法を示しています。

**AWS CLI**  
**例 1: パブリックカスタムドメイン名を作成するには**  
次の `create-domain-name` の例では、パブリックカスタムドメイン名を作成します。  

```
aws apigateway create-domain-name \
    --domain-name 'my.domain.tld' \
    --certificate-name 'my.domain.tld cert'\
    --certificate-arn 'arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3'
```
出力:  

```
{
    "domainName": "my.domain.tld",
    "certificateName": "my.domain.tld cert",
    "certificateArn": "arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3",
    "certificateUploadDate": "2024-10-08T11:29:49-07:00",
    "distributionDomainName": "abcd1234.cloudfront.net",
    "distributionHostedZoneId": "Z2FDTNDATAQYW2",
    "endpointConfiguration": {
        "types": [
            "EDGE"
        ]
    },
    "domainNameStatus": "AVAILABLE",
    "securityPolicy": "TLS_1_2"
}
```
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのパブリック REST API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html)」を参照してください。  
**例 2: プライベートカスタムドメイン名を作成するには**  
次の `create-domain-name` の例では、プライベートカスタムドメイン名を作成します。  

```
aws apigateway create-domain-name \
    --domain-name 'my.private.domain.tld' \
    --certificate-name 'my.domain.tld cert' \
    --certificate-arn 'arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3' \
    --endpoint-configuration '{"types": ["PRIVATE"]}' \
    --security-policy 'TLS_1_2' \
    --policy file://policy.json
```
`policy.json` の内容:  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "execute-api:Invoke",
            "Resource": [
                "execute-api:/*"
            ]
        },
        {
            "Effect": "Deny",
            "Principal": "*",
            "Action": "execute-api:Invoke",
            "Resource": [
                "execute-api:/*"
            ],
            "Condition" : {
                "StringNotEquals": {
                    "aws:SourceVpce": "vpce-abcd1234efg"
                }
            }
        }
    ]
}
```
出力:  

```
{
    "domainName": "my.private.domain.tld",
    "domainNameId": "abcd1234",
    "domainNameArn": "arn:aws:apigateway:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234",
    "certificateArn": "arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3",
    "certificateUploadDate": "2024-09-10T10:31:20-07:00",
    "endpointConfiguration": {
        "types": [
            "PRIVATE"
        ]
    },
    "domainNameStatus": "AVAILABLE",
    "securityPolicy": "TLS_1_2",
    "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"execute-api:Invoke\",\"Resource\":\"arn:aws:execute-api:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234\"},{\"Effect\":\"Deny\",\"Principal\":\"*\",\"Action\":\"execute-api:Invoke\",\"Resource\":\"arn:aws:execute-api:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234\",\"Condition\":{\"StringNotEquals\":{\"aws:SourceVpc\":\"vpc-1a2b3c4d\"}}}]}"
}
```
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのパブリック REST API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateDomainName](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-domain-name.html)」を参照してください。

### `create-model`
<a name="api-gateway_CreateModel_cli_topic"></a>

次のコード例では、`create-model` を使用する方法を示しています。

**AWS CLI**  
**API 用のモデルを作成する方法**  
コマンド:  

```
aws apigateway create-model --rest-api-id 1234123412 --name 'firstModel' --description 'The First Model' --content-type 'application/json'  --schema '{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "firstModel", "type": "object", "properties": { "firstProperty" : { "type": "object", "properties": { "key": { "type": "string" } } } } }'
```
出力:  

```
{
    "contentType": "application/json",
    "description": "The First Model",
    "name": "firstModel",
    "id": "2rzg0l",
    "schema": "{ \"$schema\": \"http://json-schema.org/draft-04/schema#\", \"title\": \"firstModel\", \"type\": \"object\", \"properties\": { \"firstProperty\" : { \"type\": \"object\", \"properties\": { \"key\": { \"type\": \"string\" } } } } }"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateModel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-model.html)」を参照してください。

### `create-resource`
<a name="api-gateway_CreateResource_cli_topic"></a>

次のコード例では、`create-resource` を使用する方法を示しています。

**AWS CLI**  
**API でリソースを作成する方法**  
コマンド:  

```
aws apigateway create-resource --rest-api-id 1234123412 --parent-id a1b2c3 --path-part 'new-resource'
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[CreateResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-resource.html)」を参照してください。**

### `create-rest-api`
<a name="api-gateway_CreateRestApi_cli_topic"></a>

次のコード例では、`create-rest-api` を使用する方法を示しています。

**AWS CLI**  
**API を作成する方法**  
コマンド:  

```
aws apigateway create-rest-api --name 'My First API' --description 'This is my first API'
```
**既存の API から複製 API を作成する方法**  
コマンド:  

```
aws apigateway create-rest-api --name 'Copy of My First API' --description 'This is a copy of my first API' --clone-from 1234123412
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[CreateRestApi](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-rest-api.html)」を参照してください。**

### `create-stage`
<a name="api-gateway_CreateStage_cli_topic"></a>

次のコード例では、`create-stage` を使用する方法を示しています。

**AWS CLI**  
**既存のデプロイを含む API にステージを作成する方法**  
コマンド:  

```
aws apigateway create-stage --rest-api-id 1234123412 --stage-name 'dev' --description 'Development stage' --deployment-id a1b2c3
```
**既存のデプロイとカスタムステージ変数を含む API でステージを作成する方法**  
コマンド:  

```
aws apigateway create-stage --rest-api-id 1234123412 --stage-name 'dev' --description 'Development stage' --deployment-id a1b2c3 --variables key='value',otherKey='otherValue'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateStage](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-stage.html)」を参照してください。

### `create-usage-plan-key`
<a name="api-gateway_CreateUsagePlanKey_cli_topic"></a>

次のコード例では、`create-usage-plan-key` を使用する方法を示しています。

**AWS CLI**  
**既存の API キーを使用量プランに関連付ける**  
コマンド:  

```
aws apigateway create-usage-plan-key --usage-plan-id a1b2c3 --key-type "API_KEY" --key-id 4vq3yryqm5
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateUsagePlanKey](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-usage-plan-key.html)」を参照してください。

### `create-usage-plan`
<a name="api-gateway_CreateUsagePlan_cli_topic"></a>

次のコード例では、`create-usage-plan` を使用する方法を示しています。

**AWS CLI**  
**月の初めにリセットされるスロットルとクォータの制限を使用して使用量プランを作成する方法**  
コマンド:  

```
aws apigateway create-usage-plan --name "New Usage Plan" --description "A new usage plan" --throttle burstLimit=10,rateLimit=5 --quota limit=500,offset=0,period=MONTH
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateUsagePlan](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/create-usage-plan.html)」を参照してください。

### `delete-api-key`
<a name="api-gateway_DeleteApiKey_cli_topic"></a>

次のコード例では、`delete-api-key` を使用する方法を示しています。

**AWS CLI**  
**API キーを削除する方法**  
コマンド:  

```
aws apigateway delete-api-key --api-key 8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blk
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteApiKey](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-api-key.html)」を参照してください。

### `delete-authorizer`
<a name="api-gateway_DeleteAuthorizer_cli_topic"></a>

次のコード例では、`delete-authorizer` を使用する方法を示しています。

**AWS CLI**  
**API でカスタムオーソライザーを削除する方法**  
コマンド:  

```
aws apigateway delete-authorizer --rest-api-id 1234123412 --authorizer-id 7gkfbo
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-authorizer.html)」を参照してください。

### `delete-base-path-mapping`
<a name="api-gateway_DeleteBasePathMapping_cli_topic"></a>

次のコード例では、`delete-base-path-mapping` を使用する方法を示しています。

**AWS CLI**  
**カスタムドメイン名のベースパスマッピングを削除する方法**  
コマンド:  

```
aws apigateway delete-base-path-mapping --domain-name 'api.domain.tld' --base-path 'dev'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteBasePathMapping](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-base-path-mapping.html)」を参照してください。

### `delete-client-certificate`
<a name="api-gateway_DeleteClientCertificate_cli_topic"></a>

次のコード例では、`delete-client-certificate` を使用する方法を示しています。

**AWS CLI**  
**クライアント証明書を削除する方法**  
コマンド:  

```
aws apigateway delete-client-certificate --client-certificate-id a1b2c3
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteClientCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-client-certificate.html)」を参照してください。

### `delete-deployment`
<a name="api-gateway_DeleteDeployment_cli_topic"></a>

次のコード例では、`delete-deployment` を使用する方法を示しています。

**AWS CLI**  
**API のデプロイを削除する方法**  
コマンド:  

```
aws apigateway delete-deployment --rest-api-id 1234123412 --deployment-id a1b2c3
```
+  API の詳細については、 コマンドリファレンスAWS CLIの「[DeleteDeployment](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-deployment.html)」を参照してください。**

### `delete-domain-name-access-association`
<a name="api-gateway_DeleteDomainNameAccessAssociation_cli_topic"></a>

次のコード例は、`delete-domain-name-access-association` を使用する方法を示しています。

**AWS CLI**  
**ドメイン名アクセスの関連付けを削除するには**  
次の `delete-domain-name-access-association` の例では、プライベートカスタムドメイン名と VPC エンドポイントとの間のドメイン名アクセスの関連付けを削除します。  

```
aws apigateway delete-domain-name-access-association \
    --domain-name-access-association-arn arn:aws:apigateway:us-west-2:012345678910:/domainnameaccessassociations/domainname/my.private.domain.tld/vpcesource/vpce-abcd1234efg
```
このコマンドでは何も出力されません。  
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのプライベート API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-custom-domains.html)」を参照してください。  
+  API の詳細については、*AWS CLI コマンドリファレンス*の「[DeleteDomainNameAccessAssociation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-domain-name-access-association.html)」を参照してください。

### `delete-domain-name`
<a name="api-gateway_DeleteDomainName_cli_topic"></a>

次のコード例は、`delete-domain-name` を使用する方法を示しています。

**AWS CLI**  
**カスタムドメイン名を削除する方法**  
コマンド:  

```
aws apigateway delete-domain-name --domain-name 'api.domain.tld'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteDomainName](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-domain-name.html)」を参照してください。

### `delete-integration-response`
<a name="api-gateway_DeleteIntegrationResponse_cli_topic"></a>

次のコード例では、`delete-integration-response` を使用する方法を示しています。

**AWS CLI**  
**API で特定のリソース、メソッド、ステータスコードの統合レスポンスを削除する方法**  
コマンド:  

```
aws apigateway delete-integration-response --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET --status-code 200
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteIntegrationResponse](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-integration-response.html)」を参照してください。

### `delete-integration`
<a name="api-gateway_DeleteIntegration_cli_topic"></a>

次のコード例では、`delete-integration` を使用する方法を示しています。

**AWS CLI**  
**API で特定のリソースとメソッドの統合を削除する方法**  
コマンド:  

```
aws apigateway delete-integration --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteIntegration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-integration.html)」を参照してください。

### `delete-method-response`
<a name="api-gateway_DeleteMethodResponse_cli_topic"></a>

次のコード例では、`delete-method-response` を使用する方法を示しています。

**AWS CLI**  
**API で特定のリソース、メソッド、ステータスコードのメソッドレスポンスを削除する方法**  
コマンド:  

```
aws apigateway delete-method-response --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET --status-code 200
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteMethodResponse](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-method-response.html)」を参照してください。

### `delete-method`
<a name="api-gateway_DeleteMethod_cli_topic"></a>

次のコード例では、`delete-method` を使用する方法を示しています。

**AWS CLI**  
**API で特定のリソースのメソッドを削除する方法**  
コマンド:  

```
aws apigateway delete-method --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteMethod](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-method.html)」を参照してください。

### `delete-model`
<a name="api-gateway_DeleteModel_cli_topic"></a>

次のコード例では、`delete-model` を使用する方法を示しています。

**AWS CLI**  
**特定の API でモデルを削除する方法**  
コマンド:  

```
aws apigateway delete-model --rest-api-id 1234123412 --model-name 'customModel'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteModel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-model.html)」を参照してください。

### `delete-resource`
<a name="api-gateway_DeleteResource_cli_topic"></a>

次のコード例では、`delete-resource` を使用する方法を示しています。

**AWS CLI**  
**API でリソースを削除する方法**  
コマンド:  

```
aws apigateway delete-resource --rest-api-id 1234123412 --resource-id a1b2c3
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-resource.html)」を参照してください。

### `delete-rest-api`
<a name="api-gateway_DeleteRestApi_cli_topic"></a>

次のコード例では、`delete-rest-api` を使用する方法を示しています。

**AWS CLI**  
**API を削除する方法**  
コマンド:  

```
aws apigateway delete-rest-api --rest-api-id 1234123412
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[DeleteRestApi](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-rest-api.html)」を参照してください。**

### `delete-stage`
<a name="api-gateway_DeleteStage_cli_topic"></a>

次のコード例では、`delete-stage` を使用する方法を示しています。

**AWS CLI**  
**API でインスタンスを削除する方法**  
コマンド:  

```
aws apigateway delete-stage --rest-api-id 1234123412 --stage-name 'dev'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteStage](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-stage.html)」を参照してください。

### `delete-usage-plan-key`
<a name="api-gateway_DeleteUsagePlanKey_cli_topic"></a>

次のコード例では、`delete-usage-plan-key` を使用する方法を示しています。

**AWS CLI**  
**使用量プランから API キーを削除する方法**  
コマンド:  

```
aws apigateway delete-usage-plan-key --usage-plan-id a1b2c3 --key-id 1NbjQzMReAkeEQPNAW8r3dXsU2rDD7fc7f2Sipnu
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteUsagePlanKey](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-usage-plan-key.html)」を参照してください。

### `delete-usage-plan`
<a name="api-gateway_DeleteUsagePlan_cli_topic"></a>

次のコード例では、`delete-usage-plan` を使用する方法を示しています。

**AWS CLI**  
**使用量プランを削除する方法**  
コマンド:  

```
aws apigateway delete-usage-plan --usage-plan-id a1b2c3
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteUsagePlan](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/delete-usage-plan.html)」を参照してください。

### `flush-stage-authorizers-cache`
<a name="api-gateway_FlushStageAuthorizersCache_cli_topic"></a>

次のコード例では、`flush-stage-authorizers-cache` を使用する方法を示しています。

**AWS CLI**  
**ステージのすべてのオーソライザーキャッシュエントリをすべて消去する方法**  
コマンド:  

```
aws apigateway flush-stage-authorizers-cache --rest-api-id 1234123412 --stage-name dev
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[FlushStageAuthorizersCache](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/flush-stage-authorizers-cache.html)」を参照してください。

### `flush-stage-cache`
<a name="api-gateway_FlushStageCache_cli_topic"></a>

次のコード例では、`flush-stage-cache` を使用する方法を示しています。

**AWS CLI**  
**API のステージのキャッシュをすべて消去する方法**  
次の `flush-stage-cache` の例では、ステージのキャッシュをフラッシュします。  

```
aws apigateway flush-stage-cache \
    --rest-api-id 1234123412 \
    --stage-name dev
```
このコマンドでは何も出力されません。  
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway での API ステージキャッシュをフラッシュする](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-caching.html#flush-api-caching)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[FlushStageCache](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/flush-stage-cache.html)」を参照してください。

### `generate-client-certificate`
<a name="api-gateway_GenerateClientCertificate_cli_topic"></a>

次のコード例では、`generate-client-certificate` を使用する方法を示しています。

**AWS CLI**  
**クライアント側 SSL 証明書を作成する方法**  
コマンド:  

```
aws apigateway generate-client-certificate --description 'My First Client Certificate'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GenerateClientCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/generate-client-certificate.html)」を参照してください。

### `get-account`
<a name="api-gateway_GetAccount_cli_topic"></a>

次のコード例では、`get-account` を使用する方法を示しています。

**AWS CLI**  
**API Gateway アカウント設定を取得する方法**  
コマンド:  

```
aws apigateway get-account
```
出力:  

```
{
    "cloudwatchRoleArn": "arn:aws:iam::123412341234:role/APIGatewayToCloudWatchLogsRole",
    "throttleSettings": {
        "rateLimit": 500.0,
        "burstLimit": 1000
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetAccount](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-account.html)」を参照してください。

### `get-api-key`
<a name="api-gateway_GetApiKey_cli_topic"></a>

次のコード例では、`get-api-key` を使用する方法を示しています。

**AWS CLI**  
**特定の API に関する情報を取得する方法**  
コマンド:  

```
aws apigateway get-api-key --api-key 8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blk
```
出力:  

```
{
    "description": "My first key",
    "enabled": true,
    "stageKeys": [
        "a1b2c3d4e5/dev",
        "e5d4c3b2a1/dev"
    ],
    "lastUpdatedDate": 1456184515,
    "createdDate": 1456184452,
    "id": "8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blk",
    "name": "My key"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetApiKey](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-api-key.html)」を参照してください。

### `get-api-keys`
<a name="api-gateway_GetApiKeys_cli_topic"></a>

次のコード例では、`get-api-keys` を使用する方法を示しています。

**AWS CLI**  
**API キーの一覧を取得する方法**  
コマンド:  

```
aws apigateway get-api-keys
```
出力:  

```
{
    "items": [
        {
            "description": "My first key",
            "enabled": true,
            "stageKeys": [
                "a1b2c3d4e5/dev",
                "e5d4c3b2a1/dev"
            ],
            "lastUpdatedDate": 1456184515,
            "createdDate": 1456184452,
            "id": "8bklk8bl1k3sB38D9B3l0enyWT8c09B30lkq0blk",
            "name": "My key"
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetApiKeys](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-api-keys.html)」を参照してください。

### `get-authorizer`
<a name="api-gateway_GetAuthorizer_cli_topic"></a>

次のコード例では、`get-authorizer` を使用する方法を示しています。

**AWS CLI**  
**API Gateway per-API Authorizer 設定を取得する方法**  
コマンド:  

```
aws apigateway get-authorizer --rest-api-id 1234123412 --authorizer-id gfi4n3
```
出力:  

```
{
    "authorizerResultTtlInSeconds": 300,
    "name": "MyAuthorizer",
    "type": "TOKEN",
    "identitySource": "method.request.header.Authorization",
    "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:authorizer_function/invocations",
    "id": "gfi4n3"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-authorizer.html)」を参照してください。

### `get-authorizers`
<a name="api-gateway_GetAuthorizers_cli_topic"></a>

次のコード例では、`get-authorizers` を使用する方法を示しています。

**AWS CLI**  
**REST API のオーソライザーの一覧を取得する方法**  
コマンド:  

```
aws apigateway get-authorizers --rest-api-id 1234123412
```
出力:  

```
{
    "items": [
        {
            "name": "MyAuthorizer",
            "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:My_Authorizer_Function/invocations",
            "authorizerResultTtlInSeconds": 300,
            "identitySource": "method.request.header.Authorization",
            "type": "TOKEN",
            "id": "gfi4n3"
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetAuthorizers](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-authorizers.html)」を参照してください。

### `get-base-path-mapping`
<a name="api-gateway_GetBasePathMapping_cli_topic"></a>

次のコード例では、`get-base-path-mapping` を使用する方法を示しています。

**AWS CLI**  
**カスタムドメイン名のベースパスマッピングを取得する方法**  
コマンド:  

```
aws apigateway get-base-path-mapping --domain-name subdomain.domain.tld --base-path v1
```
出力:  

```
{
    "basePath": "v1",
    "restApiId": "1234w4321e",
    "stage": "api"
}
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[GetBasePathMapping](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-base-path-mapping.html)」を参照してください。**

### `get-base-path-mappings`
<a name="api-gateway_GetBasePathMappings_cli_topic"></a>

次のコード例では、`get-base-path-mappings` を使用する方法を示しています。

**AWS CLI**  
**カスタムドメイン名のベースパスマッピングを取得する方法**  
コマンド:  

```
aws apigateway get-base-path-mappings --domain-name subdomain.domain.tld
```
出力:  

```
{
    "items": [
        {
            "basePath": "(none)",
            "restApiId": "1234w4321e",
            "stage": "dev"
        },
        {
            "basePath": "v1",
            "restApiId": "1234w4321e",
            "stage": "api"
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetBasePathMappings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-base-path-mappings.html)」を参照してください。

### `get-client-certificate`
<a name="api-gateway_GetClientCertificate_cli_topic"></a>

次のコード例では、`get-client-certificate` を使用する方法を示しています。

**AWS CLI**  
**クライアント証明書を取得する方法**  
コマンド:  

```
aws apigateway get-client-certificate --client-certificate-id a1b2c3
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetClientCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-client-certificate.html)」を参照してください。

### `get-client-certificates`
<a name="api-gateway_GetClientCertificates_cli_topic"></a>

次のコード例では、`get-client-certificates` を使用する方法を示しています。

**AWS CLI**  
**クライアント証明書の一覧を取得する方法**  
コマンド:  

```
aws apigateway get-client-certificates
```
出力:  

```
{
    "items": [
        {
            "pemEncodedCertificate": "-----BEGIN CERTIFICATE----- <certificate content> -----END CERTIFICATE-----",
            "clientCertificateId": "a1b2c3",
            "expirationDate": 1483556561,
            "description": "My Client Certificate",
            "createdDate": 1452020561
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetClientCertificates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-client-certificates.html)」を参照してください。

### `get-deployment`
<a name="api-gateway_GetDeployment_cli_topic"></a>

次のコード例では、`get-deployment` を使用する方法を示しています。

**AWS CLI**  
**デプロイの情報を取得する方法**  
コマンド:  

```
aws apigateway get-deployment --rest-api-id 1234123412 --deployment-id ztt4m2
```
出力:  

```
{
    "description": "myDeployment",
    "id": "ztt4m2",
    "createdDate": 1455218022
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetDeployment](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-deployment.html)」を参照してください。

### `get-deployments`
<a name="api-gateway_GetDeployments_cli_topic"></a>

次のコード例では、`get-deployments` を使用する方法を示しています。

**AWS CLI**  
**REST API のデプロイの一覧を取得する方法**  
コマンド:  

```
aws apigateway get-deployments --rest-api-id 1234123412
```
出力:  

```
{
    "items": [
        {
            "createdDate": 1453797217,
            "id": "0a2b4c",
            "description": "Deployed my API for the first time"
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetDeployments](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-deployments.html)」を参照してください。

### `get-domain-name-access-associations`
<a name="api-gateway_GetDomainNameAccessAssociations_cli_topic"></a>

次のコード例は、`get-domain-name-access-associations` を使用する方法を示しています。

**AWS CLI**  
**例 1: すべてのドメイン名アクセスの関連付けを一覧表示するには**  
次の `get-domain-name-access-associations` の例では、すべてのドメイン名アクセスの関連付けを一覧表示します。  

```
aws apigateway get-domain-name-access-associations
```
出力:  

```
{
    "items": [
        {
        "domainNameAccessAssociationArn": "arn:aws:apigateway:us-west-2:012345678910:/domainnameaccessassociations/domainname/my.private.domain.tld/vpcesource/vpce-abcd1234efg
        "accessAssociationSource": "vpce-abcd1234efg",
        "accessAssociationSourceType": "VPCE",
        "domainNameArn" : "arn:aws:apigateway:us-west-2:111122223333:/domainnames/private.example.com+abcd1234"
        }
    ]
}
```
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのプライベート API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-custom-domains.html)」を参照してください。  
**例 2: この AWS アカウントが所有するすべてのドメイン名アクセスの関連付けを一覧表示するには**  
次の `get-domain-name-access-associations` の例では、現在の AWS アカウントが所有するすべてのドメイン名アクセスの関連付けを一覧表示します。  

```
aws apigateway get-domain-name-access-associations \
    --resource-owner SELF
```
出力:  

```
{
    "items": [
        {
        "domainNameAccessAssociationArn": "arn:aws:apigateway:us-west-2:012345678910:/domainnameaccessassociations/domainname/my.private.domain.tld/vpcesource/vpce-abcd1234efg
        "accessAssociationSource": "vpce-abcd1234efg",
        "accessAssociationSourceType": "VPCE",
        "domainNameArn" : "arn:aws:apigateway:us-west-2:111122223333:/domainnames/private.example.com+abcd1234"
        }
    ]
}
```
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのプライベート API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-custom-domains.html)」を参照してください。  
+  API の詳細については、*AWS CLI コマンドリファレンス*の「[GetDomainNameAccessAssociations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-domain-name-access-associations.html)」を参照してください。

### `get-domain-name`
<a name="api-gateway_GetDomainName_cli_topic"></a>

次のコード例は、`get-domain-name` を使用する方法を示しています。

**AWS CLI**  
**例 1: パブリックカスタムドメイン名に関する情報を取得するには**  
次の `get-domain-name` の例では、パブリックカスタムドメイン名に関する情報を取得します。  

```
aws apigateway get-domain-name \
    --domain-name api.domain.tld
```
出力:  

```
{
    "domainName": "api.domain.tld",
    "distributionDomainName": "d1a2f3a4c5o6d.cloudfront.net",
    "certificateName": "uploadedCertificate",
    "certificateUploadDate": 1462565487
}
```
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのパブリック REST API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html)」を参照してください。  
**例 2: プライベートカスタムドメイン名に関する情報を取得するには**  
次の `get-domain-name` の例では、プライベートカスタムドメイン名に関する情報を取得します。  

```
aws apigateway get-domain-name \
    --domain-name api.private.domain.tld \
    --domain-name-id abcd1234
```
出力:  

```
{
    "domainName": "my.private.domain.tld",
    "domainNameId": "abcd1234",
    "domainNameArn": "arn:aws:apigateway:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234",
    "certificateArn": "arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3",
    "certificateUploadDate": "2024-09-10T10:31:20-07:00",
    "endpointConfiguration": {
        "types": [
            "PRIVATE"
        ]
    },
    "domainNameStatus": "AVAILABLE",
    "securityPolicy": "TLS_1_2",
    "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":\"*\",\"Action\":\"execute-api:Invoke\",\"Resource\":\"arn:aws:execute-api:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234\"},{\"Effect\":\"Deny\",\"Principal\":\"*\",\"Action\":\"execute-api:Invoke\",\"Resource\":\"arn:aws:execute-api:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234\",\"Condition\":{\"StringNotEquals\":{\"aws:SourceVpc\":\"vpc-1a2b3c4d\"}}}]}"
}
```
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのパブリック REST API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetDomainName](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-domain-name.html)」を参照してください。

### `get-domain-names`
<a name="api-gateway_GetDomainNames_cli_topic"></a>

次のコード例は、`get-domain-names` を使用する方法を示しています。

**AWS CLI**  
**例 1: カスタムドメイン名のリストを取得するには**  
次の `get-domain-names` コマンドは、ドメイン名のリストを取得します。  

```
aws apigateway get-domain-names
```
出力:  

```
{
    "items": [
        {
            "distributionDomainName": "d9511k3l09bkd.cloudfront.net",
            "certificateUploadDate": 1452812505,
            "certificateName": "my_custom_domain-certificate",
            "domainName": "subdomain.domain.tld"
        }
    ]
}
```
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのプライベート API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-custom-domains.html)」を参照してください。  
**例 2: この AWS アカウントが所有するカスタムドメイン名のリストを取得するには**  
次の `get-domain-names` コマンドは、この AWS アカウントが所有するドメイン名のリストを取得します。  

```
aws apigateway get-domain-names \
    --resource-owner SELF
```
出力:  

```
{
    "items": [
        {
            "domainName": "my.domain.tld",
            "domainNameArn": "arn:aws:apigateway:us-east-1::/domainnames/my.private.domain.tld",
            "certificateUploadDate": "2024-08-15T17:02:55-07:00",
            "regionalDomainName": "d-abcd1234.execute-api.us-east-1.amazonaws.com",
            "regionalHostedZoneId": "Z1UJRXOUMOOFQ8",
            "regionalCertificateArn": "arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3",
            "endpointConfiguration": {
                "types": [
                    "REGIONAL"
                ]
            },
            "domainNameStatus": "AVAILABLE",
            "securityPolicy": "TLS_1_2"
        },
        {
            "domainName": "my.private.domain.tld",
            "domainNameId": "abcd1234",
            "domainNameArn": "arn:aws:apigateway:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234",
            "certificateArn": "arn:aws:acm:us-east-1:012345678910:certificate/fb1b9770-a305-495d-aefb-27e5e101ff3",
            "certificateUploadDate": "2024-11-26T11:44:40-08:00",
            "endpointConfiguration": {
                "types": [
                    "PRIVATE"
                ]
            },
            "domainNameStatus": "AVAILABLE",
            "securityPolicy": "TLS_1_2"
        }
    ]
}
```
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのプライベート API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-custom-domains.html)」を参照してください。  
**例 3: 他の AWS アカウントが所有し、お客様がドメイン名アクセスの関連付けを作成できるカスタムドメイン名のリストを取得します。**  
次の `get-domain-names` コマンドは、他の AWS アカウントが所有し、アクセス関連付けを作成できるカスタムドメイン名のリストを取得します。  

```
aws apigateway get-domain-names \
    --resource-owner OTHER_ACCOUNTS
```
出力:  

```
{
    "items": [
        {
            "domainName": "my.private.domain.tld",
            "domainNameId": "abcd1234",
            "domainNameArn": "arn:aws:apigateway:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234"
        }
    ]
}
```
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのプライベート API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-custom-domains.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetDomainNames](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-domain-names.html)」を参照してください。

### `get-export`
<a name="api-gateway_GetExport_cli_topic"></a>

次のコード例では、`get-export` を使用する方法を示しています。

**AWS CLI**  
**ステージの JSON Swagger テンプレートを取得するには**  
コマンド:  

```
aws apigateway get-export --rest-api-id a1b2c3d4e5 --stage-name dev --export-type swagger /path/to/filename.json
```
**ステージの JSON Swagger テンプレート \$1 API Gateway Extentions を取得する方法**  
コマンド:  

```
aws apigateway get-export --parameters extensions='integrations' --rest-api-id a1b2c3d4e5 --stage-name dev --export-type swagger /path/to/filename.json
```
**ステージの JSON Swagger テンプレート \$1 Postman Extensions を取得する方法**  
コマンド:  

```
aws apigateway get-export --parameters extensions='postman' --rest-api-id a1b2c3d4e5 --stage-name dev --export-type swagger /path/to/filename.json
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetExport](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-export.html)」を参照してください。

### `get-integration-response`
<a name="api-gateway_GetIntegrationResponse_cli_topic"></a>

次のコード例では、`get-integration-response` を使用する方法を示しています。

**AWS CLI**  
**REST API のリソースで定義された HTTP メソッドの統合レスポンス構成を取得する方法**  
コマンド:  

```
aws apigateway get-integration-response --rest-api-id 1234123412 --resource-id y9h6rt --http-method GET --status-code 200
```
出力:  

```
{
    "statusCode": "200",
    "responseTemplates": {
        "application/json": null
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetIntegrationResponse](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-integration-response.html)」を参照してください。

### `get-integration`
<a name="api-gateway_GetIntegration_cli_topic"></a>

次のコード例では、`get-integration` を使用する方法を示しています。

**AWS CLI**  
**REST API のリソースで定義された HTTP メソッドの統合構成を取得する方法**  
コマンド:  

```
aws apigateway get-integration --rest-api-id 1234123412 --resource-id y9h6rt --http-method GET
```
出力:  

```
{
    "httpMethod": "POST",
    "integrationResponses": {
        "200": {
            "responseTemplates": {
                "application/json": null
            },
            "statusCode": "200"
        }
    },
    "cacheKeyParameters": [],
    "type": "AWS",
    "uri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:My_Function/invocations",
    "cacheNamespace": "y9h6rt"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetIntegration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-integration.html)」を参照してください。

### `get-method-response`
<a name="api-gateway_GetMethodResponse_cli_topic"></a>

次のコード例では、`get-method-response` を使用する方法を示しています。

**AWS CLI**  
**REST API のリソースで定義された HTTP メソッドのメソッドレスポンスリソース構成を取得する方法**  
コマンド:  

```
aws apigateway get-method-response --rest-api-id 1234123412 --resource-id y9h6rt --http-method GET --status-code 200
```
出力:  

```
{
    "responseModels": {
        "application/json": "Empty"
    },
    "statusCode": "200"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetMethodResponse](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-method-response.html)」を参照してください。

### `get-method`
<a name="api-gateway_GetMethod_cli_topic"></a>

次のコード例では、`get-method` を使用する方法を示しています。

**AWS CLI**  
**REST API のリソースで定義された HTTP メソッドのメソッドリソース構成を取得する方法**  
コマンド:  

```
aws apigateway get-method --rest-api-id 1234123412 --resource-id y9h6rt --http-method GET
```
出力:  

```
{
    "apiKeyRequired": false,
    "httpMethod": "GET",
    "methodIntegration": {
        "integrationResponses": {
            "200": {
                "responseTemplates": {
                    "application/json": null
                },
                "statusCode": "200"
            }
        },
        "cacheKeyParameters": [],
        "uri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:My_Function/invocations",
        "httpMethod": "POST",
        "cacheNamespace": "y9h6rt",
        "type": "AWS"
    },
    "requestParameters": {},
    "methodResponses": {
        "200": {
            "responseModels": {
                "application/json": "Empty"
            },
            "statusCode": "200"
        }
    },
    "authorizationType": "NONE"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetMethod](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-method.html)」を参照してください。

### `get-model-template`
<a name="api-gateway_GetModelTemplate_cli_topic"></a>

次のコード例では、`get-model-template` を使用する方法を示しています。

**AWS CLI**  
**REST API で定義されたモデルのマッピングテンプレートを取得する方法**  
コマンド:  

```
aws apigateway get-model-template --rest-api-id 1234123412 --model-name Empty
```
出力:  

```
{
    "value": "#set($inputRoot = $input.path('$'))\n{ }"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetModelTemplate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-model-template.html)」を参照してください。

### `get-model`
<a name="api-gateway_GetModel_cli_topic"></a>

次のコード例では、`get-model` を使用する方法を示しています。

**AWS CLI**  
**REST API で定義されたモデルの構成を取得する方法**  
コマンド:  

```
aws apigateway get-model --rest-api-id 1234123412 --model-name Empty
```
出力:  

```
{
    "contentType": "application/json",
    "description": "This is a default empty schema model",
    "name": "Empty",
    "id": "etd5w5",
    "schema": "{\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n  \"title\" : \"Empty Schema\",\n  \"type\" : \"object\"\n}"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetModel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-model.html)」を参照してください。

### `get-models`
<a name="api-gateway_GetModels_cli_topic"></a>

次のコード例では、`get-models` を使用する方法を示しています。

**AWS CLI**  
**REST API のリソースの一覧を取得する方法**  
コマンド:  

```
aws apigateway get-models --rest-api-id 1234123412
```
出力:  

```
{
    "items": [
        {
            "description": "This is a default error schema model",
            "schema": "{\n  \"$schema\" : \"http://json-schema.org/draft-04/schema#\",\n  \"title\" : \"Error Schema\",\n  \"type\" : \"object\",\n  \"properties\" : {\n    \"message\" : { \"type\" : \"string\" }\n  }\n}",
            "contentType": "application/json",
            "id": "7tpbze",
            "name": "Error"
        },
        {
            "description": "This is a default empty schema model",
            "schema": "{\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n  \"title\" : \"Empty Schema\",\n  \"type\" : \"object\"\n}",
            "contentType": "application/json",
            "id": "etd5w5",
            "name": "Empty"
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetModels](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-models.html)」を参照してください。

### `get-resource`
<a name="api-gateway_GetResource_cli_topic"></a>

次のコード例では、`get-resource` を使用する方法を示しています。

**AWS CLI**  
**リソースに関する情報を取得する方法**  
コマンド:  

```
aws apigateway get-resource --rest-api-id 1234123412 --resource-id zwo0y3
```
出力:  

```
{
    "path": "/path",
    "pathPart": "path",
    "id": "zwo0y3",
    "parentId": "uyokt6ij2g"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-resource.html)」を参照してください。

### `get-resources`
<a name="api-gateway_GetResources_cli_topic"></a>

次のコード例では、`get-resources` を使用する方法を示しています。

**AWS CLI**  
**REST API のリソースの一覧を取得する方法**  
コマンド:  

```
aws apigateway get-resources --rest-api-id 1234123412
```
出力:  

```
{
    "items": [
        {
            "path": "/resource/subresource",
            "resourceMethods": {
                "POST": {}
            },
            "id": "024ace",
            "pathPart": "subresource",
            "parentId": "ai5b02"
        }
    ]
}
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[GetResources](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-resources.html)」を参照してください。**

### `get-rest-api`
<a name="api-gateway_GetRestApi_cli_topic"></a>

次のコード例では、`get-rest-api` を使用する方法を示しています。

**AWS CLI**  
**API に関する情報を取得する方法**  
コマンド:  

```
aws apigateway get-rest-api --rest-api-id 1234123412
```
出力:  

```
{
    "name": "myAPI",
    "id": "o1y243m4f5",
    "createdDate": 1453416433
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetRestApi](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-rest-api.html)」を参照してください。

### `get-rest-apis`
<a name="api-gateway_GetRestApis_cli_topic"></a>

次のコード例では、`get-rest-apis` を使用する方法を示しています。

**AWS CLI**  
**REST API の一覧を取得する方法**  
コマンド:  

```
aws apigateway get-rest-apis
```
出力:  

```
{
    "items": [
        {
            "createdDate": 1438884790,
            "id": "12s44z21rb",
            "name": "My First API"
        }
    ]
}
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[GetRestApis](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-rest-apis.html)」を参照してください。**

### `get-sdk`
<a name="api-gateway_GetSdk_cli_topic"></a>

次のコード例では、`get-sdk` を使用する方法を示しています。

**AWS CLI**  
**REST API ステージの Android SDK を取得する方法**  
コマンド:  

```
aws apigateway get-sdk --rest-api-id 1234123412 --stage-name dev --sdk-type android --parameters groupId='com.mycompany',invokerPackage='com.mycompany.clientsdk',artifactId='Mycompany-client',artifactVersion='1.0.0' /path/to/android_sdk.zip
```
出力:  

```
{
    "contentType": "application/octet-stream",
    "contentDisposition": "attachment; filename=\"android_2016-02-22_23-52Z.zip\""
}
```
**REST API ステージの IOS SDK を取得する方法**  
コマンド:  

```
aws apigateway get-sdk --rest-api-id 1234123412 --stage-name dev --sdk-type objectivec --parameters classPrefix='myprefix' /path/to/iOS_sdk.zip
```
出力:  

```
{
    "contentType": "application/octet-stream",
    "contentDisposition": "attachment; filename=\"objectivec_2016-02-22_23-52Z.zip\""
}
```
**REST API ステージの Javascript SDK を取得する方法**  
コマンド:  

```
aws apigateway get-sdk --rest-api-id 1234123412 --stage-name dev --sdk-type javascript /path/to/javascript_sdk.zip
```
出力:  

```
{
    "contentType": "application/octet-stream",
    "contentDisposition": "attachment; filename=\"javascript_2016-02-22_23-52Z.zip\""
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetSdk](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-sdk.html)」を参照してください。

### `get-stage`
<a name="api-gateway_GetStage_cli_topic"></a>

次のコード例では、`get-stage` を使用する方法を示しています。

**AWS CLI**  
**API のステージに関する情報を取得する方法**  
コマンド:  

```
aws apigateway get-stage --rest-api-id 1234123412 --stage-name dev
```
出力:  

```
{
    "stageName": "dev",
    "cacheClusterSize": "0.5",
    "cacheClusterEnabled": false,
    "cacheClusterStatus": "NOT_AVAILABLE",
    "deploymentId": "rbh1fj",
    "lastUpdatedDate": 1466802961,
    "createdDate": 1460682074,
    "methodSettings": {
        "*/*": {
            "cacheTtlInSeconds": 300,
            "loggingLevel": "INFO",
            "dataTraceEnabled": false,
            "metricsEnabled": true,
            "unauthorizedCacheControlHeaderStrategy": "SUCCEED_WITH_RESPONSE_HEADER",
            "throttlingRateLimit": 500.0,
            "cacheDataEncrypted": false,
            "cachingEnabled": false,
            "throttlingBurstLimit": 1000,
            "requireAuthorizationForCacheControl": true
        },
        "~1resource/GET": {
            "cacheTtlInSeconds": 300,
            "loggingLevel": "INFO",
            "dataTraceEnabled": false,
            "metricsEnabled": true,
            "unauthorizedCacheControlHeaderStrategy": "SUCCEED_WITH_RESPONSE_HEADER",
            "throttlingRateLimit": 500.0,
            "cacheDataEncrypted": false,
            "cachingEnabled": false,
            "throttlingBurstLimit": 1000,
            "requireAuthorizationForCacheControl": true
        }
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetStage](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-stage.html)」を参照してください。

### `get-stages`
<a name="api-gateway_GetStages_cli_topic"></a>

次のコード例では、`get-stages` を使用する方法を示しています。

**AWS CLI**  
**REST API のリソースの一覧を取得する方法**  
コマンド:  

```
aws apigateway get-stages --rest-api-id 1234123412
```
出力:  

```
{
    "item": [
        {
            "stageName": "dev",
            "cacheClusterSize": "0.5",
            "cacheClusterEnabled": true,
            "cacheClusterStatus": "AVAILABLE",
            "deploymentId": "123h64",
            "lastUpdatedDate": 1456185138,
            "createdDate": 1453589092,
            "methodSettings": {
                "~1resource~1subresource/POST": {
                    "cacheTtlInSeconds": 300,
                    "loggingLevel": "INFO",
                    "dataTraceEnabled": true,
                    "metricsEnabled": true,
                    "throttlingRateLimit": 500.0,
                    "cacheDataEncrypted": false,
                    "cachingEnabled": false,
                    "throttlingBurstLimit": 1000
                }
            }
        }
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetStages](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-stages.html)」を参照してください。

### `get-usage-plan-key`
<a name="api-gateway_GetUsagePlanKey_cli_topic"></a>

次のコード例では、`get-usage-plan-key` を使用する方法を示しています。

**AWS CLI**  
**Usage Plan に関連付けられた API キーの詳細を取得する方法**  
コマンド:  

```
aws apigateway get-usage-plan-key --usage-plan-id a1b2c3 --key-id 1NbjQzMReAkeEQPNAW8r3dXsU2rDD7fc7f2Sipnu
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetUsagePlanKey](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-usage-plan-key.html)」を参照してください。

### `get-usage-plan-keys`
<a name="api-gateway_GetUsagePlanKeys_cli_topic"></a>

次のコード例では、`get-usage-plan-keys` を使用する方法を示しています。

**AWS CLI**  
**使用量プランに関連付けられた API キーの一覧を取得する方法**  
コマンド:  

```
aws apigateway get-usage-plan-keys --usage-plan-id a1b2c3
```
+  API の詳細については、「**AWS CLI コマンドリファレンス」の「[GetUsagePlanKeys](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-usage-plan-keys.html)」を参照してください。

### `get-usage-plan`
<a name="api-gateway_GetUsagePlan_cli_topic"></a>

次のコード例では、`get-usage-plan` を使用する方法を示しています。

**AWS CLI**  
**使用量プランの詳細を取得する方法**  
コマンド:  

```
aws apigateway get-usage-plan --usage-plan-id a1b2c3
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetUsagePlan](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-usage-plan.html)」を参照してください。

### `get-usage-plans`
<a name="api-gateway_GetUsagePlans_cli_topic"></a>

次のコード例では、`get-usage-plans` を使用する方法を示しています。

**AWS CLI**  
**すべての使用量プランの詳細を取得する方法**  
コマンド:  

```
aws apigateway get-usage-plans
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetUsagePlans](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-usage-plans.html)」を参照してください。

### `get-usage`
<a name="api-gateway_GetUsage_cli_topic"></a>

次のコード例では、`get-usage` を使用する方法を示しています。

**AWS CLI**  
**使用量プランの使用の詳細を取得する方法**  
コマンド:  

```
aws apigateway get-usage --usage-plan-id a1b2c3 --start-date "2016-08-16" --end-date "2016-08-17"
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetUsage](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/get-usage.html)」を参照してください。

### `import-rest-api`
<a name="api-gateway_ImportRestApi_cli_topic"></a>

次のコード例では、`import-rest-api` を使用する方法を示しています。

**AWS CLI**  
**Swagger テンプレートをインポートして API を作成する方法**  
コマンド:  

```
aws apigateway import-rest-api --body 'file:///path/to/API_Swagger_template.json'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ImportRestApi](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/import-rest-api.html)」を参照してください。

### `put-integration-response`
<a name="api-gateway_PutIntegrationResponse_cli_topic"></a>

次のコード例では、`put-integration-response` を使用する方法を示しています。

**AWS CLI**  
**マッピングテンプレートを定義して、統合レスポンスをデフォルトレスポンスとして作成する方法**  
コマンド:  

```
aws apigateway put-integration-response --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET --status-code 200 --selection-pattern "" --response-templates '{"application/json": "{\"json\": \"template\"}"}'
```
**regex が 400 でヘッダー値が静的に定義された統合レスポンスを作成する方法**  
コマンド:  

```
aws apigateway put-integration-response --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET --status-code 400 --selection-pattern 400 --response-parameters '{"method.response.header.custom-header": "'"'"'custom-value'"'"'"}'
```
+  API の詳細については、**AWS CLI コマンドリファレンスの「[PutIntegrationResponse](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/put-integration-response.html)」を参照してください。

### `put-integration`
<a name="api-gateway_PutIntegration_cli_topic"></a>

次のコード例では、`put-integration` を使用する方法を示しています。

**AWS CLI**  
**MOCK 統合リクエストを作成する方法**  
コマンド:  

```
aws apigateway put-integration --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET --type MOCK --request-templates '{ "application/json": "{\"statusCode\": 200}" }'
```
**HTTP 統合リクエストを作成する方法**  
コマンド:  

```
aws apigateway put-integration --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET --type HTTP --integration-http-method GET --uri 'https://domain.tld/path'
```
**Lambda 関数エンドポイントを使用して AWS 統合リクエストを作成する方法**  
コマンド:  

```
aws apigateway put-integration --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET --type AWS --integration-http-method POST --uri 'arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:function_name/invocations'
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[PutIntegration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/put-integration.html)」を参照してください。**

### `put-method-response`
<a name="api-gateway_PutMethodResponse_cli_topic"></a>

次のコード例では、`put-method-response` を使用する方法を示しています。

**AWS CLI**  
**カスタムメソッドレスポンスヘッダーを使用して、指定したステータスコードでメソッドレスポンスを作成する方法**  
コマンド:  

```
aws apigateway put-method-response --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET --status-code 400 --response-parameters "method.response.header.custom-header=false"
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[PutMethodResponse](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/put-method-response.html)」を参照してください。**

### `put-method`
<a name="api-gateway_PutMethod_cli_topic"></a>

次のコード例では、`put-method` を使用する方法を示しています。

**AWS CLI**  
**権限なし、API キーなし、カスタムメソッドリクエストヘッダーありで API 内のリソース用のメソッドを作成する方法**  
コマンド:  

```
aws apigateway put-method --rest-api-id 1234123412 --resource-id a1b2c3 --http-method PUT --authorization-type "NONE" --no-api-key-required --request-parameters "method.request.header.custom-header=false"
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[PutMethod](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/put-method.html)」を参照してください。**

### `put-rest-api`
<a name="api-gateway_PutRestApi_cli_topic"></a>

次のコード例では、`put-rest-api` を使用する方法を示しています。

**AWS CLI**  
**Swagger テンプレートを使用して既存の API を上書きする方法**  
コマンド:  

```
aws apigateway put-rest-api --rest-api-id 1234123412 --mode overwrite --body 'fileb:///path/to/API_Swagger_template.json'
```
**Swagger テンプレートを既存の API にマージする方法**  
コマンド:  

```
aws apigateway put-rest-api --rest-api-id 1234123412 --mode merge --body 'fileb:///path/to/API_Swagger_template.json'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[PutRestApi](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/put-rest-api.html)」を参照してください。

### `reject-domain-name-access-association`
<a name="api-gateway_RejectDomainNameAccessAssociation_cli_topic"></a>

次のコード例は、`reject-domain-name-access-association` を使用する方法を示しています。

**AWS CLI**  
**ドメイン名アクセスの関連付けを拒否するには**  
次の `reject-domain-name-access-association` の例では、プライベートカスタムドメイン名と VPC エンドポイントとの間のドメイン名アクセスの関連付けを拒否します。  

```
aws apigateway reject-domain-name-access-association \
    --domain-name-access-association-arn arn:aws:apigateway:us-west-2:012345678910:/domainnameaccessassociations/domainname/my.private.domain.tld/vpcesource/vpce-abcd1234efg \
    --domain-name-arn arn:aws:apigateway:us-east-1:012345678910:/domainnames/my.private.domain.tld+abcd1234
```
このコマンドでは何も出力されません。  
詳細については、*Amazon API Gateway デベロッパーガイド*の「[API Gateway でのプライベート API 用のカスタムドメイン名](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-custom-domains.html)」を参照してください。  
+  API の詳細については、*AWS CLI コマンドリファレンス*の「[RejectDomainNameAccessAssociation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/reject-domain-name-access-association.html)」を参照してください。

### `test-invoke-authorizer`
<a name="api-gateway_TestInvokeAuthorizer_cli_topic"></a>

次のコード例は、`test-invoke-authorizer` を使用する方法を示しています。

**AWS CLI**  
**必要なヘッダーと値を含むカスタムオーソライザーへのリクエストをテストする方法**  
コマンド:  

```
aws apigateway test-invoke-authorizer --rest-api-id 1234123412 --authorizer-id 5yid1t --headers Authorization='Value'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[TestInvokeAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/test-invoke-authorizer.html)」を参照してください。

### `test-invoke-method`
<a name="api-gateway_TestInvokeMethod_cli_topic"></a>

次のコード例では、`test-invoke-method` を使用する方法を示しています。

**AWS CLI**  
**GET リクエストを実行して API のルートリソースをテストする方法**  
コマンド:  

```
aws apigateway test-invoke-method --rest-api-id 1234123412 --resource-id avl5sg8fw8 --http-method GET --path-with-query-string '/'
```
**パスパラメータ値を指定して GET リクエストを実行し、API でサブリソースを呼び出すテストをする方法**  
コマンド:  

```
aws apigateway test-invoke-method --rest-api-id 1234123412 --resource-id 3gapai --http-method GET --path-with-query-string '/pets/1'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[TestInvokeMethod](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/test-invoke-method.html)」を参照してください。

### `update-account`
<a name="api-gateway_UpdateAccount_cli_topic"></a>

次のコード例では、`update-account` を使用する方法を示しています。

**AWS CLI**  
**CloudWatch Logs へのログ記録用の IAM ロール ARN を変更する方法**  
コマンド:  

```
aws apigateway update-account --patch-operations op='replace',path='/cloudwatchRoleArn',value='arn:aws:iam::123412341234:role/APIGatewayToCloudWatchLogs'
```
出力:  

```
{
    "cloudwatchRoleArn": "arn:aws:iam::123412341234:role/APIGatewayToCloudWatchLogs",
    "throttleSettings": {
        "rateLimit": 1000.0,
        "burstLimit": 2000
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateAccount](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-account.html)」を参照してください。

### `update-api-key`
<a name="api-gateway_UpdateApiKey_cli_topic"></a>

次のコード例では、`update-api-key` を使用する方法を示しています。

**AWS CLI**  
**API キーの名前を変更する方法**  
コマンド:  

```
aws apigateway update-api-key --api-key sNvjQDMReA1eEQPNAW8r37XsU2rDD7fc7m2SiMnu --patch-operations op='replace',path='/name',value='newName'
```
出力:  

```
{
    "description": "currentDescription",
    "enabled": true,
    "stageKeys": [
        "41t2j324r5/dev"
    ],
    "lastUpdatedDate": 1470086052,
    "createdDate": 1445460347,
    "id": "sNvjQDMReA1vEQPNzW8r3dXsU2rrD7fcjm2SiMnu",
    "name": "newName"
}
```
**API キーを無効にする方法**  
コマンド:  

```
aws apigateway update-api-key --api-key sNvjQDMReA1eEQPNAW8r37XsU2rDD7fc7m2SiMnu --patch-operations op='replace',path='/enabled',value='false'
```
出力:  

```
{
    "description": "currentDescription",
    "enabled": false,
    "stageKeys": [
        "41t2j324r5/dev"
    ],
    "lastUpdatedDate": 1470086052,
    "createdDate": 1445460347,
    "id": "sNvjQDMReA1vEQPNzW8r3dXsU2rrD7fcjm2SiMnu",
    "name": "newName"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateApiKey](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-api-key.html)」を参照してください。

### `update-authorizer`
<a name="api-gateway_UpdateAuthorizer_cli_topic"></a>

次のコード例では、`update-authorizer` を使用する方法を示しています。

**AWS CLI**  
**Custom Authorizer の名前を変更する方法**  
コマンド:  

```
aws apigateway update-authorizer --rest-api-id 1234123412 --authorizer-id gfi4n3 --patch-operations op='replace',path='/name',value='testAuthorizer'
```
出力:  

```
{
    "authType": "custom",
    "name": "testAuthorizer",
    "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:customAuthorizer/invocations",
    "authorizerResultTtlInSeconds": 300,
    "identitySource": "method.request.header.Authorization",
    "type": "TOKEN",
    "id": "gfi4n3"
}
```
**カスタムオーソライザーによって呼び出される Lambda 関数を変更する方法**  
コマンド:  

```
aws apigateway update-authorizer --rest-api-id 1234123412 --authorizer-id gfi4n3 --patch-operations op='replace',path='/authorizerUri',value='arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:newAuthorizer/invocations'
```
出力:  

```
{
    "authType": "custom",
    "name": "testAuthorizer",
    "authorizerUri": "arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:newAuthorizer/invocations",
    "authorizerResultTtlInSeconds": 300,
    "identitySource": "method.request.header.Authorization",
    "type": "TOKEN",
    "id": "gfi4n3"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateAuthorizer](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-authorizer.html)」を参照してください。

### `update-base-path-mapping`
<a name="api-gateway_UpdateBasePathMapping_cli_topic"></a>

次のコード例では、`update-base-path-mapping` を使用する方法を示しています。

**AWS CLI**  
**カスタムドメイン名のベースパスマッピングを変更する方法**  
コマンド:  

```
aws apigateway update-base-path-mapping --domain-name api.domain.tld --base-path prod --patch-operations op='replace',path='/basePath',value='v1'
```
出力:  

```
{
    "basePath": "v1",
    "restApiId": "1234123412",
    "stage": "api"
}
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[UpdateBasePathMapping](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-base-path-mapping.html)」を参照してください。**

### `update-client-certificate`
<a name="api-gateway_UpdateClientCertificate_cli_topic"></a>

次のコード例では、`update-client-certificate` を使用する方法を示しています。

**AWS CLI**  
**クライアント証明書の説明を更新する方法**  
コマンド:  

```
aws apigateway update-client-certificate --client-certificate-id a1b2c3 --patch-operations op='replace',path='/description',value='My new description'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateClientCertificate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-client-certificate.html)」を参照してください。

### `update-deployment`
<a name="api-gateway_UpdateDeployment_cli_topic"></a>

次のコード例では、`update-deployment` を使用する方法を示しています。

**AWS CLI**  
**デプロイの説明を変更する方法**  
コマンド:  

```
aws apigateway update-deployment --rest-api-id 1234123412 --deployment-id ztt4m2 --patch-operations op='replace',path='/description',value='newDescription'
```
出力:  

```
{
    "description": "newDescription",
    "id": "ztt4m2",
    "createdDate": 1455218022
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateDeployment](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-deployment.html)」を参照してください。

### `update-domain-name`
<a name="api-gateway_UpdateDomainName_cli_topic"></a>

次のコード例では、`update-domain-name` を使用する方法を示しています。

**AWS CLI**  
**カスタムドメイン名の証明書を変更する方法**  
次の `update-domain-name` の例では、カスタムドメインの証明書名を変更します。  

```
aws apigateway update-domain-name \
    --domain-name api.domain.tld \
    --patch-operations op='replace',path='/certificateArn',value='arn:aws:acm:us-west-2:111122223333:certificate/CERTEXAMPLE123EXAMPLE'
```
出力:  

```
{
    "domainName": "api.domain.tld",
    "distributionDomainName": "d123456789012.cloudfront.net",
    "certificateArn": "arn:aws:acm:us-west-2:111122223333:certificate/CERTEXAMPLE123EXAMPLE",
    "certificateUploadDate": 1462565487
}
```
詳細については、「*Amazon API Gateway デベロッパーガイド*」の「[Set up Custom Domain Name for an API in API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateDomainName](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-domain-name.html)」を参照してください。

### `update-integration-response`
<a name="api-gateway_UpdateIntegrationResponse_cli_topic"></a>

次のコード例では、`update-integration-response` を使用する方法を示しています。

**AWS CLI**  
**統合レスポンスヘッダーを「\$1」の静的マッピングに変更する方法**  
コマンド:  

```
aws apigateway update-integration-response --rest-api-id 1234123412 --resource-id 3gapai --http-method GET --status-code 200 --patch-operations op='replace',path='/responseParameters/method.response.header.Access-Control-Allow-Origin',value='"'"'*'"'"'
```
出力:  

```
{
    "statusCode": "200",
    "responseParameters": {
        "method.response.header.Access-Control-Allow-Origin": "'*'"
    }
}
```
**統合レスポンスヘッダーを削除する方法**  
コマンド:  

```
aws apigateway update-integration-response --rest-api-id 1234123412 --resource-id 3gapai --http-method GET --status-code 200 --patch-operations op='remove',path='/responseParameters/method.response.header.Access-Control-Allow-Origin'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateIntegrationResponse](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-integration-response.html)」を参照してください。

### `update-integration`
<a name="api-gateway_UpdateIntegration_cli_topic"></a>

次のコード例では、`update-integration` を使用する方法を示しています。

**AWS CLI**  
**Input Passthrough で設定された「コンテンツタイプ: application/json」マッピングテンプレートを追加する方法**  
コマンド:  

```
aws apigateway update-integration \
    --rest-api-id a1b2c3d4e5 \
    --resource-id a1b2c3 \
    --http-method POST \
    --patch-operations "op='add',path='/requestTemplates/application~1json'"
```
**カスタムテンプレートで設定された「コンテンツタイプ: application/json」マッピングテンプレートを更新 (置き換え) する方法**  
コマンド:  

```
aws apigateway update-integration \
    --rest-api-id a1b2c3d4e5 \
    --resource-id a1b2c3 \
    --http-method POST \
    --patch-operations "op='replace',path='/requestTemplates/application~1json',value='{"example": "json"}'"
```
**コンテンツタイプ: application/json」に関連付けられたカスタムテンプレートを Input Passthrough で更新 (置き換え) する方法**  
コマンド:  

```
aws apigateway update-integration \
    --rest-api-id a1b2c3d4e5 \
    --resource-id a1b2c3 \
    --http-method POST \
    --patch-operations "op='replace',path='requestTemplates/application~1json'"
```
**コンテンツタイプ: application/json」マッピングテンプレートを削除する方法**  
コマンド:  

```
aws apigateway update-integration \
    --rest-api-id a1b2c3d4e5 \
    --resource-id a1b2c3 \
    --http-method POST \
    --patch-operations "op='remove',path='/requestTemplates/application~1json'"
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateIntegration](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-integration.html)」を参照してください。

### `update-method-response`
<a name="api-gateway_UpdateMethodResponse_cli_topic"></a>

次のコード例では、`update-method-response` を使用する方法を示しています。

**AWS CLI**  
**メソッドで 200 レスポンスの新しいメソッドレスポンスヘッダーを作成し、不要として定義する方法 (デフォルト）**  
コマンド:  

```
aws apigateway update-method-response --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET --status-code 200 --patch-operations op="add",path="/responseParameters/method.response.header.custom-header",value="false"
```
**メソッドで 200 レスポンスのレスポンスモデルを削除する方法**  
コマンド:  

```
aws apigateway update-method-response --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET --status-code 200 --patch-operations op="remove",path="/responseModels/application~1json"
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateMethodResponse](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-method-response.html)」を参照してください。

### `update-method`
<a name="api-gateway_UpdateMethod_cli_topic"></a>

次のコード例では、`update-method` を使用する方法を示しています。

**AWS CLI**  
**例 1: API キーを要求するようにメソッドを変更する方法**  
次の `update-method` の例では、API キーを要求するようにメソッドを変更します。  

```
aws apigateway update-method \
    --rest-api-id 1234123412 \
    --resource-id a1b2c3 \
    --http-method GET \
    --patch-operations op="replace",path="/apiKeyRequired",value="true"
```
出力:  

```
{
    "httpMethod": "GET",
    "authorizationType": "NONE",
    "apiKeyRequired": true,
    "methodResponses": {
        "200": {
            "statusCode": "200",
            "responseModels": {}
        }
    },
    "methodIntegration": {
        "type": "AWS",
        "httpMethod": "POST",
        "uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789111:function:hello-world/invocations",
        "passthroughBehavior": "WHEN_NO_MATCH",
        "contentHandling": "CONVERT_TO_TEXT",
        "timeoutInMillis": 29000,
        "cacheNamespace": "h7i8j9",
        "cacheKeyParameters": [],
        "integrationResponses": {
            "200": {
                "statusCode": "200",
                "responseTemplates": {}
            }
        }
    }
}
```
**例 2: メソッドを変更して IAM 認証を要求する方法**  
次の `update-method` の例では、IAM 認証を必要とするようにメソッドを変更します。  

```
aws apigateway update-method \
    --rest-api-id 1234123412 \
    --resource-id a1b2c3 \
    --http-method GET \
    --patch-operations op="replace",path="/authorizationType",value="AWS_IAM"
```
出力:  

```
 {
    "httpMethod": "GET",
    "authorizationType": "AWS_IAM",
    "apiKeyRequired": false,
    "methodResponses": {
        "200": {
            "statusCode": "200",
            "responseModels": {}
        }
    },
    "methodIntegration": {
        "type": "AWS",
        "httpMethod": "POST",
        "uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789111:function:hello-world/invocations",
        "passthroughBehavior": "WHEN_NO_MATCH",
        "contentHandling": "CONVERT_TO_TEXT",
        "timeoutInMillis": 29000,
        "cacheNamespace": "h7i8j9",
        "cacheKeyParameters": [],
        "integrationResponses": {
            "200": {
                "statusCode": "200",
                "responseTemplates": {}
            }
        }
    }
}
```
**例 3: Lambda 認証を要求するようにメソッドを変更する方法**  
次の `update-method` の例では、メソッドを必要な Lambda 認証に変更します。  

```
aws apigateway update-method --rest-api-id 1234123412 \
    --resource-id a1b2c3 \
    --http-method GET \
    --patch-operations op="replace",path="/authorizationType",value="CUSTOM" op="replace",path="/authorizerId",value="e4f5g6"
```
出力:  

```
 {
    "httpMethod": "GET",
    "authorizationType": "CUSTOM",
    "authorizerId" : "e4f5g6",
    "apiKeyRequired": false,
    "methodResponses": {
        "200": {
            "statusCode": "200",
            "responseModels": {}
        }
    },
    "methodIntegration": {
        "type": "AWS",
        "httpMethod": "POST",
        "uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789111:function:hello-world/invocations",
        "passthroughBehavior": "WHEN_NO_MATCH",
        "contentHandling": "CONVERT_TO_TEXT",
        "timeoutInMillis": 29000,
        "cacheNamespace": "h7i8j9",
        "cacheKeyParameters": [],
        "integrationResponses": {
            "200": {
                "statusCode": "200",
                "responseTemplates": {}
            }
        }
    }
}
```
詳細については、「*Amazon API Gateway デベロッパーガイド*」の「[API Gateway CLI と REST API を使用した使用量プランの作成、設定、テスト](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-usage-plans-with-rest-api.html)」と「[API Gateway の REST API へのアクセスの制御と管理](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-control-access-to-api.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateMethod](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-method.html)」を参照してください。

### `update-model`
<a name="api-gateway_UpdateModel_cli_topic"></a>

次のコード例では、`update-model` を使用する方法を示しています。

**AWS CLI**  
**API でモデルの説明を変更する方法**  
コマンド:  

```
aws apigateway update-model --rest-api-id 1234123412 --model-name 'Empty' --patch-operations op=replace,path=/description,value='New Description'
```
**API でモデルのスキーマを変更する方法**  
コマンド:  

```
aws apigateway update-model --rest-api-id 1234123412 --model-name 'Empty' --patch-operations op=replace,path=/schema,value='"{ \"$schema\": \"http://json-schema.org/draft-04/schema#\", \"title\" : \"Empty Schema\", \"type\" : \"object\" }"'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateModel](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-model.html)」を参照してください。

### `update-resource`
<a name="api-gateway_UpdateResource_cli_topic"></a>

次のコード例では、`update-resource` を使用する方法を示しています。

**AWS CLI**  
**リソースを移動して API 内の別の親リソースに配置する方法**  
コマンド:  

```
aws apigateway update-resource --rest-api-id 1234123412 --resource-id 1a2b3c --patch-operations op=replace,path=/parentId,value='3c2b1a'
```
出力:  

```
{
    "path": "/resource",
    "pathPart": "resource",
    "id": "1a2b3c",
    "parentId": "3c2b1a"
}
```
**API でリソース (pathPart) の名前を変更する方法**  
コマンド:  

```
aws apigateway update-resource --rest-api-id 1234123412 --resource-id 1a2b3c --patch-operations op=replace,path=/pathPart,value=newresourcename
```
出力:  

```
{
    "path": "/newresourcename",
    "pathPart": "newresourcename",
    "id": "1a2b3c",
    "parentId": "3c2b1a"
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-resource.html)」を参照してください。

### `update-rest-api`
<a name="api-gateway_UpdateRestApi_cli_topic"></a>

次のコード例では、`update-rest-api` を使用する方法を示しています。

**AWS CLI**  
**API の名前を変更する方法**  
コマンド:  

```
aws apigateway update-rest-api --rest-api-id 1234123412 --patch-operations op=replace,path=/name,value='New Name'
```
**API の説明を変更する方法**  
コマンド:  

```
aws apigateway update-rest-api --rest-api-id 1234123412 --patch-operations op=replace,path=/description,value='New Description'
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateRestApi](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-rest-api.html)」を参照してください。

### `update-stage`
<a name="api-gateway_UpdateStage_cli_topic"></a>

次のコード例では、`update-stage` を使用する方法を示しています。

**AWS CLI**  
**例 1: リソースとメソッドのステージ設定を上書きする方法**  
次の `update-stage` の例では、ステージ設定を上書きし、特定のリソースとメソッドの完全なリクエスト/レスポンスログ記録をオフにします。  

```
aws apigateway update-stage \
    --rest-api-id 1234123412 \
    --stage-name 'dev' \
    --patch-operations op=replace,path=/~1resourceName/GET/logging/dataTrace,value=false
```
出力:  

```
{
    "deploymentId": "5ubd17",
    "stageName": "dev",
    "cacheClusterEnabled": false,
    "cacheClusterStatus": "NOT_AVAILABLE",
    "methodSettings": {
        "~1resourceName/GET": {
            "metricsEnabled": false,
            "dataTraceEnabled": false,
            "throttlingBurstLimit": 5000,
            "throttlingRateLimit": 10000.0,
            "cachingEnabled": false,
            "cacheTtlInSeconds": 300,
            "cacheDataEncrypted": false,
            "requireAuthorizationForCacheControl": true,
            "unauthorizedCacheControlHeaderStrategy": "SUCCEED_WITH_RESPONSE_HEADER"
        }
    },
    "tracingEnabled": false,
    "createdDate": "2022-07-18T10:11:18-07:00",
    "lastUpdatedDate": "2022-07-18T10:19:04-07:00"
}
```
詳細については、「*Amazon API Gateway デベロッパーガイド*」の「[REST API にステージを設定](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-stages.html)」を参照してください。  
**例 2: API ステージのすべてのリソースとメソッドのステージ設定を更新する方法**  
次の `update-stage` の例では、API ステージのすべてのリソースとメソッドの完全なリクエスト/レスポンスログ記録をオンにします。  

```
aws apigateway update-stage \
    --rest-api-id 1234123412 \
    --stage-name 'dev' \
    --patch-operations 'op=replace,path=/*/*/logging/dataTrace,value=true'
```
出力:  

```
{
    "deploymentId": "5ubd17",
    "stageName": "dev",
    "cacheClusterEnabled": false,
    "cacheClusterStatus": "NOT_AVAILABLE",
    "methodSettings": {
        "*/*": {
            "metricsEnabled": false,
            "dataTraceEnabled": true,
            "throttlingBurstLimit": 5000,
            "throttlingRateLimit": 10000.0,
            "cachingEnabled": false,
            "cacheTtlInSeconds": 300,
            "cacheDataEncrypted": false,
            "requireAuthorizationForCacheControl": true,
            "unauthorizedCacheControlHeaderStrategy": "SUCCEED_WITH_RESPONSE_HEADER"
        }
    },
    "tracingEnabled": false,
    "createdDate": "2022-07-18T10:11:18-07:00",
    "lastUpdatedDate": "2022-07-18T10:31:04-07:00"
}
```
詳細については、「*Amazon API Gateway デベロッパーガイド*」の「[REST API にステージを設定](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-stages.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateStage](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-stage.html)」を参照してください。

### `update-usage-plan`
<a name="api-gateway_UpdateUsagePlan_cli_topic"></a>

次のコード例では、`update-usage-plan` を使用する方法を示しています。

**AWS CLI**  
**使用量プランで定義された期間を変更する方法**  
コマンド:  

```
aws apigateway update-usage-plan --usage-plan-id a1b2c3 --patch-operations op="replace",path="/quota/period",value="MONTH"
```
**使用量プランで定義されているクォータ制限を変更する方法**  
コマンド:  

```
aws apigateway update-usage-plan --usage-plan-id a1b2c3 --patch-operations op="replace",path="/quota/limit",value="500"
```
**使用量プランで定義されているスロットルレート制限を変更する方法**  
コマンド:  

```
aws apigateway update-usage-plan --usage-plan-id a1b2c3 --patch-operations op="replace",path="/throttle/rateLimit",value="10"
```
**使用量プランで定義されているスロットルバースト制限を変更する方法**  
コマンド:  

```
aws apigateway update-usage-plan --usage-plan-id a1b2c3 --patch-operations op="replace",path="/throttle/burstLimit",value="20"
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateUsagePlan](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-usage-plan.html)」を参照してください。

### `update-usage`
<a name="api-gateway_UpdateUsage_cli_topic"></a>

次のコード例では、`update-usage` を使用する方法を示しています。

**AWS CLI**  
**使用量プランで定義されている現在の期間の API キーのクォータを一時的に変更する方法**  
コマンド:  

```
aws apigateway update-usage --usage-plan-id a1b2c3 --key-id 1NbjQzMReAkeEQPNAW8r3dXsU2rDD7fc7f2Sipnu --patch-operations op="replace",path="/remaining",value="50"
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateUsage](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-usage.html)」を参照してください。

### `update-vpc-link`
<a name="api-gateway_UpdateVpcLink_cli_topic"></a>

次の例は、`update-vpc-link` を使用する方法を説明しています。

**AWS CLI**  
**例 1: 既存の VPC リンク名を更新するには**  
次の `update-vpc-link` の例では、指定された VPC リンクの名前を更新します。  

```
aws apigateway update-vpc-link  \
    --vpc-link-id ab3de6 \
    --patch-operations op=replace,path=/name,value=my-vpc-link
```
出力:  

```
{
    "id": "ab3de6",
    "name": "my-vpc-link",
    "targetArns": [
        "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/net/my-lb/12a456s89aaa12345"
    ],
    "status": "AVAILABLE",
    "statusMessage": "Your vpc link is ready for use",
    "tags": {}
}
```
詳細については、「*AWS CLI コマンドリファレンス*」の「[既存の VPC リンクの更新](https://docs.aws.amazon.com/cli/latest/reference/apigateway/update-vpc-link.html)」を参照してください。  
**例 2: 既存の VPC リンク名と説明を更新するには**  
次の `update-vpc-link` の例では、指定された VPC リンクの名前を更新します。  

```
aws apigateway update-vpc-link  \
    --vpc-link-id ab3de6 \
    --patch-operations op=replace,path=/name,value=my-vpc-link op=replace,path=/description,value="My custom description"
```
出力:  

```
{
    "id": "ab3de6",
    "name": "my-vpc-link",
    "description": "My custom description",
    "targetArns": [
        "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/net/my-lb/12a456s89aaa12345"
    ],
    "status": "AVAILABLE",
    "statusMessage": "Your vpc link is ready for use",
    "tags": {}
}
```
詳細については、「*AWS CLI コマンドリファレンス*」の「[既存の VPC リンクの更新](https://docs.aws.amazon.com/cli/latest/reference/apigateway/update-vpc-link.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateVpcLink](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/apigateway/update-vpc-link.html)」を参照してください。