I am creating a template in YAML format for creating a stack. In api gateway i want to set a value for endpoint id in private type. is there a way i can do it in template? or can i do it using boto3?
ApiGateway:
Type: 'AWS::ApiGateway::RestApi'
Properties:
Description: A test API
Name: !Ref ApiName
EndpointConfiguration:
Types:
- "PRIVATE"
vpcEndpointIds:
- !Ref VPC
This code is giving error that there is no property vpcEndpointIds.
From this cloudformation document it seems it has now been added to cloudformation
. However aws-cdk
doesnt seem to reflect this update but the following (untested) code should get what you want, assuming the cloudformation
docs reflect the current state.
const api = new RestApi(this, 'APIGateway', {
deploy: true,
deployOptions: {
stageName: 'live',
tracingEnabled: true,
},
endpointTypes: [EndpointType.PRIVATE],
retainDeployments: false,
restApiName: 'my-api',
description: 'an api',
});
const cfnApi = api.node.defaultChild as CfnMethod;
cfnApi.addOverride('Properties.EndpointConfiguration.VpcEndpointIds', ['12345']);
See here here for details on adding missing features to constructs.
Cloudforamtion doesn't support it.This can be done using boto3 api gateway client:
client_api_gateway.update_rest_api(restApiId=self.api_id,
patchOperations=[
{
'op': 'add',
'path': '/endpointConfiguration/vpcEndpointIds',
'value': vpc_endpoint_id
}
])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.