lambda policies need a virtualenv installation.
See original GitHub issueGetting the following error in the cloudwatch log stream associated with the lambda function provisioned after running a policy:
Unable to import module ‘custodian_policy’: No module named pkg_resources
using the policy below and invoking it with custodian run -c policy.yml -s out --log-group=/cloud-custodian/dev-account/us-west-2 --region us-west-2 -m
Is there something I’m missing that is causing the mu to not create the lambda function zip file correctly?
policies:
- name: ec2-require-non-public-and-encrypted-volumes
resource: ec2
description: |
Provision a lambda and cloud watch event target
that looks at all new instances not in an autoscale group
and terminates those with unencrypted volumes.
mode:
type: cloudtrail
role: arn:aws:iam::XXXXXXXXXXXX:role/custodianRole
events:
- RunInstances
filters:
- "tag:aws:autoscaling:groupName": absent
- type: ebs
key: Encrypted
value: false
actions:
- terminate
- name: tag-compliance
resource: ec2
description:
Schedule a resource that does not meet tag compliance policies
to be stopped in four days.
filters:
- State.Name: running
- "tag:Environment": absent
- "tag:AppId": absent
- or:
- "tag:OwnerContact": absent
- "tag:DeptID": absent
actions:
- type: mark-for-op
op: stop
days: 4
Issue Analytics
- State:
- Created 7 years ago
- Comments:35 (7 by maintainers)
Top Results From Across the Web
Deploy Python Lambda functions with .zip file archives
Activate the virtual environment. For example: · Install libraries with pip. (myvenv) ~/my-function$ pip install requests · Deactivate the virtual environment.
Read more >AWS Lambda with Python 3 and virtualenv failed to install ...
In this build process, I create two virtualenv, install my dependencies into them and then I zip my lambda deployment packages composed by:...
Read more >Using Virtual Environments with Lambda Stack - DeepTalk
Use Lambda Stack as an easy way to install your Drivers, CUDA, CuDNN, etc. ... you'll simply install Lambda Stack and then create...
Read more >Serverless Framework — Package Your Lambda Functions ...
AWS Lambda is one of the powerful service for running serverless workloads ... If you don't have virtualenv installed you can install it...
Read more >How to Install Python Packages for AWS Lambda Layers
1. Build ... Hopefully, you have Docker set up but if you don't then be sure to do that first. The first thing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@whit537 could you have a look at this one.
awesome