"tags" values in "zappa_settings.py" are not applied to the API Gateway stage that Zappa creates
See original GitHub issueThe tags
section of zappa_settings.py
is documented as follows:
"tags": { // Attach additional tags to AWS Resources
"Key": "Value", // Example Key and value
"Key2": "Value2",
},
However, when deploying for API Gateway, the tags are only applied to the Lambda function, not to the associated API Gateway stage.
Context
This is a bit of an issue, primarily as AWS tags are often used for:
- Cost allocation
- Third-party AWS metric services (such as Datadog)
When tags aren’t applied to the API Gateway stage that Zappa creates and maintains, then they can’t be used to track API Gateway specific costs or used in third-party metric services to filter metrics/set monitoring alerts.
Expected Behavior
The tags specified in the tags
section of zappa_settings.py
should be applied to all AWS resources that Zappa creates/manages.
Actual Behavior
Tags are only applied to the Lambda function.
Possible Fix
Apply the same tags that are applied to the Lambda function when creating/updating the API Gateway stage.
Steps to Reproduce
- Create a Zappa project that uses API Gateway
- Set some tag key/values in the
tags
section ofzappa_settings.py
in the Zappa project - Deploy the API Gateway API
- Select the API Gateway stage that Zappa has created in the AWS console and select the “Configure Tags” button - no tags are present
Your Environment
-
Zappa version used: 0.48.2
-
Operating System and Python version: Linux (Ubuntu 18.04) - Python 3.6
-
The output of
pip freeze
:argcomplete==1.9.3 boto3==1.9.172 botocore==1.12.172 certifi==2019.6.16 cfn-flip==1.2.1 chardet==3.0.4 Click==7.0 docutils==0.14 durationpy==0.5 future==0.16.0 hjson==3.0.1 idna==2.8 jmespath==0.9.3 kappa==0.6.0 lambda-packages==0.20.0 pkg-resources==0.0.0 placebo==0.9.0 python-dateutil==2.6.1 python-slugify==1.2.4 PyYAML==5.1.1 requests==2.22.0 s3transfer==0.2.1 six==1.12.0 toml==0.10.0 tqdm==4.19.1 troposphere==2.4.7 Unidecode==1.1.0 urllib3==1.25.3 Werkzeug==0.15.4 wsgi-request-logger==0.4.6 zappa==0.48.2
-
Your
zappa_settings.py
:{ "test": { "project_name": "test", "apigateway_description": "Test.", "app_function": "service.app", "runtime": "python3.6", "apigateway_enabled": true, "keep_warm": false, "timeout_seconds": 900, "memory_size": 3008, "extra_permissions": [ { "Effect": "Allow", "Action": [ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:Query", "dynamodb:UpdateItem", "iam:PassRole" ], "Resource": "*" } ], "tags": { "tag_key_1": "tag_value_1", "tag_key_2": "tag_value_2" } } }
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6
@Miserlou Any chance the tagging tweak in the linked PR could get into the next Zappa release? I think it’s pretty benign but, at the moment, we’re having to use the forked Zappa in our production deployments so that we’re tagged correctly (and we’d prefer to be back onto your normal PyPi release, so we can pick up other released changed easily).
PR has now been updated so that it also tags ALBs.