Skip to content
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

Aws private api deployment #725

Closed
Prev Previous commit
Next Next commit
Added private api policy
  • Loading branch information
James S Abrue Mieses committed Nov 5, 2023
commit 77eb387c173ae006b98da25cda2e4a3c3b30323f
16 changes: 14 additions & 2 deletions deployment/aws/cdk/app.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
RestApi,
)
from aws_cdk.aws_apigatewayv2_integrations_alpha import HttpLambdaIntegration
from aws_cdk.aws_iam import PolicyDocument
from aws_cdk.aws_iam import Effect, PolicyDocument, PolicyStatement
from config import StackSettings
from constructs import Construct

@@ -76,7 +76,19 @@ def __init__(
self,
f"{id}-endpoint",
default_integration=LambdaIntegration(handler=lambda_function),
policy=PolicyDocument(statements=[]),
policy=PolicyDocument(
statements=[
PolicyStatement(
effect=Effect.ALLOW,
actions=["execute-api:*"],
resources=[
Stack.of(self).format_arn(
service="execute-api", resource="*"
)
],
)
]
),
endpoint_configuration=EndpointConfiguration(types=[EndpointType.PRIVATE]),
)
CfnOutput(self, "Endpoint", value=api.url)