-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(apigateway): expose endpointconfiguration to include vpcEndpointIds #6078
Conversation
fixes aws#6038 BREAKING CHANGE: the interface now accepts endpointconfiguration property instead of endpoint type as defined by cfn
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
It looks like the
If that's correct, then I must be missing something? I expected there to be breaking changes with this. Any recommendations on how to proceed to resolve this? |
apigateway is a stable module. By contract, breaking changes are not allowed in this package. The closest you can do is mark methods and properties as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add entries into the README describing your changes and code snippets.
Fix the PR title so it correctly describes the new feature being added. I would suggest "support private vpc endpoints"
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Your suggestions have been implemented. Ready for review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's mostly there. A few comments and suggestions below to polish it up -
const vpcEndpointIds = (props.endpointConfiguration.vpcEndpoints) ? | ||
props.endpointConfiguration.vpcEndpoints.map(vpcEndpoint => vpcEndpoint.vpcEndpointId) : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would optional chaining simplify this?
const vpcEndpointIds = (props.endpointConfiguration.vpcEndpoints) ? | |
props.endpointConfiguration.vpcEndpoints.map(vpcEndpoint => vpcEndpoint.vpcEndpointId) : undefined; | |
const vpcEndpointIds = props.endpointConfiguration.vpcEndpoints?.map(vpce => vpce.vpcEndpointId); |
You can also create an association between your Rest Api and a Vpc Endpoint. By doing so, | ||
Api Gateway will generate a new Route53 Alias DNS record which you can use to invoke your private | ||
APIs. Here is an example: | ||
|
||
```ts | ||
const someEndpoint: IVpcEndpoint = /* Get or Create endpoint here */ | ||
const api = new apigw.RestApi(stack, 'api', { | ||
endpointConfiguration: { | ||
types: [ apigw.EndpointType.PRIVATE ], | ||
vpcEndpoints: [someEndpoint] | ||
} | ||
}); | ||
``` | ||
|
||
By performing this association, we can invoke the api gateway using the following format: | ||
``` | ||
https://{rest-api-id}-{vpce-id}.execute-api.{region}.amazonaws.com/{stage} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How hard is it to add an integration test that sets up a simple VPC endpoint and associates it to the Rest API, such that it is invokable by running curl
against https://{rest-api-id}-{vpce-id}.execute-api.{region}.amazonaws.com/{stage}
?
This would be useful as described here as well as to link off from the documentation as a working example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback. No problem at all. I can go ahead and add the integration test, but you are not suggesting to add an automated way to curl right? Just create the integration test and add Stack verification steps:
so that it could be tested manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late reply. Yes, that's correct, Manual verification is fine.
Pull request has been modified.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
proposed changes Co-Authored-By: Niranjan Jayakar <16217941+nija-at@users.noreply.github.com>
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add the suggested integration test please?
Pull request has been modified.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@nija-at Thanks for reviewing. I added the integration test - I think it's ready for another go. |
Thank you for contributing! Your pull request is now being automatically merged. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request is now being automatically merged. |
fixes #6038 by exposing endpointConfiguration to include vpcEndpointIds
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license