Handling Private API gateway resource policy as long with lambda policy when using chalice deploy
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
Hello!
I have updated to the new chalice release 1.11.0. I have seen that there are two tickets related with my request:
https://github.com/aws/chalice/issues/976
https://github.com/aws/chalice/issues/897
I would like to handle both lambda and API gateway Resource policy in the same file.
When I ran the
`chalice deploy --no-autogen-policy`
I bumped in:
**chalice.deploy.deployer.ChaliceDeploymentError: ERROR - While deploying your chalice application, received the following error:
An error occurred (MalformedPolicyDocument) when calling the PutRolePolicy
operation: Policy document should not specify a principal**.
Therefore, my questions are:
1. How to properly distinguish in policy.json bewteen the lambda policy statements and API Gateway Resource policy statements?
2. Can you please provide a working example where you can set up both the API Gateway resource policy as PRIVATE with a VPC/VPC endpoint and lambda policies?
3. In my policy.json file the part related with vpcendpoint should be deployed to API Gateway Resource policy. How to to cope that in the policy.json?
Thank you.
Below are my configurations for config.json and policy-dev.json :
**config.json**
```
{
"version": "2.0",
"app_name": "florin-priv-policy",
"stages": {
"dev": {
"api_gateway_stage": "api",
"api_gateway_endpoint_type": "PRIVATE",
"api_gateway_policy_file": "policy-dev.json"
}
}
}
```
**policy.json**
```
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:CreateNetworkInterface",
"ec2:DeleteNetworkInterface",
"ec2:DescribeNetworkInterfaces"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": [
"arn:aws:logs:*:*:*"
]
},
{
"Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": "arn:aws:execute-api:*:*:*",
"Condition": {
"StringEquals": {
"aws:SourceVpce": "vpce-"
}
}
}
]
}
```
Contributor guide
Research direction
Start with config.json and policy-dev.json, then reproduce the `chalice deploy --no-autogen-policy` failure described in the issue. Review issues #976 and #897 for the existing policy behavior; done should support separate Lambda and private API Gateway resource policies, including the VPC endpoint condition, with a working deployment example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- api, cloud, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100