Skip to content

Best way to scope lambda functions Allowed principals #137

Answered by kichik
diegoaguilar asked this question in Q&A
Discussion options

You must be logged in to vote

With 0.9.2 you can use:

new GitHubRunners(this, 'runners', {
  statusAccess: LambdaAccess.apiGateway({
    // only allow access to the status function from my IP
    allowedIps: ['1.2.3.4/32'], // example of my IP
  }),
  webhookAccess: LambdaAccess.apiGateway({
    // only allow access to the webhook from GitHub webhook IPs
    allowedIps: LambdaAccess.githubWebhookIps(),
  }),
  setupAccess: LambdaAccess.apiGateway({
    // only allow devs in the devSg to access setup through myVpc
    // this creates a private API Gateway that doesn't even resolve publicly
    allowedVpc: myVpc,
    allowedSecurityGroups: devSg,
  }),
});

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@diegoaguilar
Comment options

@diegoaguilar
Comment options

@kichik
Comment options

@diegoaguilar
Comment options

@kichik
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by kichik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants