Skip to content

Secure API-GateWay with AVP using CDK?

0

It is very simple to secure an API with AVP following e.g. https://aws.amazon.com/de/blogs/security/authorize-api-gateway-apis-using-amazon-verified-permissions-and-amazon-cognito/

But for a real-live-deployment this should be automated. I had a look to the current CDK-docs and also to https://constructs.dev/packages/@cdklabs/cdk-verified-permissions/v/0.1.4?lang=typescript, but can't find the point where to reference my api-gateway. Did I miss something?

2 Answers
1
Accepted Answer

The wizard available in the AWS Console uses CloudFormation to deploy a Lambda authorizer for API Gateway and attach it to the endpoints you selected. These custom actions are not part of a CDK Construct. I'm afraid you'll have to code them by yourself. If you already deployed AVP with the wizard you should be able to get inspiration from the Lambda authorizer code that was deployed and the policy store it created. The rest is quite standard API Gateway CDK code.

AWS

answered 2 years ago

EXPERT

reviewed 2 years ago

  • Thanks Philippe, I was afraid, that this would be the answer. In fact I'm not that concerned about copy/pasting the code from the wizard-generated lambda and integrate in my stack in a fisrt step, but I am concerned about keeping that code up to date in future and checking/reviewing for security issues and so on. The idea, that this (pretty crucial) lambda-code ist maintained and kept up to date by AWS-Team and updated with future cdk-deployments if needed seems still very attractive for me. At least: Where does this lambda code come from? Is there maybe a public repo we could watch to get updates?

1

Unfortunately, no such repository. On a longer perspective, we can expect a more native integration between API Gateway and AVP. No details available yet though. So, if it were for my own needs, I'd start with this Lambda and keep an eye on new features announcements for AVP.

AWS

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.