Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • 20:14
  • Jul 11 15:36
    marcoceppi opened #5944
  • Jul 11 15:19
    marcoceppi labeled #5943
  • Jul 11 15:19
    marcoceppi opened #5943
  • Jul 11 08:11
  • Jul 10 21:50
    michael-bowen-sc starred cloud-custodian/cloud-custodian
  • Jul 10 20:47
    kylejohnson514 synchronize #5942
  • Jul 10 20:45
    jtroberts83 edited #5941
  • Jul 10 20:30
    kylejohnson514 opened #5942
  • Jul 10 19:54
    jtroberts83 opened #5941
  • Jul 10 19:54
    jtroberts83 labeled #5941
  • Jul 10 17:17
    anovis commented #5908
  • Jul 10 15:33
    mikejgray commented #5740
  • Jul 10 15:32
    mikejgray commented #5740
  • Jul 10 15:32
    mikejgray commented #5740
  • Jul 10 15:17
    Lucas-Irvine opened #5940
  • Jul 10 15:17
    Lucas-Irvine labeled #5940
  • Jul 10 15:05
  • Jul 09 20:34
    antonioalmeidab starred cloud-custodian/cloud-custodian
  • Jul 09 20:04
    kapilt labeled #5939
Amarankit Srivastava

Hello Team, Delete with additional options is supported for IAM users but not for Roles and Grps? ``` actions:

  - type: delete
      - inline-user-policies


Jamison Roberts
Hi @kapilt I see that version 9.2.0 is supposed to have tag support for codecommit and codepipeline but those don't show up in the schema as an option in
4 replies
Fidel Rodriguez

Is anyone having this error for vpc flow logs using s3 buckets? 2020-05-27 18:24:02,273: custodian.output:ERROR Error while executing policy
14:24:02 Traceback (most recent call last):
14:24:02 File "/usr/local/lib/python3.7/site-packages/c7n/", line 291, in run
14:24:02 resources = self.policy.resource_manager.resources()
14:24:02 File "/usr/local/lib/python3.7/site-packages/c7n/", line 466, in resources
14:24:02 resources = self.filter_resources(resources)
14:24:02 File "/usr/local/lib/python3.7/site-packages/c7n/", line 109, in filter_resources
14:24:02 resources = f.process(resources, event)
14:24:02 File "/usr/local/lib/python3.7/site-packages/c7n/filters/", line 299, in process
14:24:02 return self.process_set(resources, event)
14:24:02 File "/usr/local/lib/python3.7/site-packages/c7n/filters/", line 318, in process_set
14:24:02 resources = f.process(resources, event)
14:24:02 File "/usr/local/lib/python3.7/site-packages/c7n/resources/", line 149, in process
14:24:02 fl['LogDestination'], destination)
14:24:02 KeyError: 'LogDestination'


  • name: vpc-flowlog-enable-s3-test-GovCloud
    resource: vpc
    - not:
      - type: flow-logs
        enabled: true
        set-op: or
        op: equal
        traffic-type: all
        status: active
        destination: vpcflow-govcloud
2 replies
custodian version is 0.9.1
Todd Stansell
@kapilt is the github CI environment broken? PRs don't seem to be able to run tests...
4 replies
Michael Nguyen

Hello, it seems I'm having trouble with this variable {account_id}. I'm running it on docker with version Here is my policy, mailer.yml and output. I did a dryrun where it runs custodian and the mailer. Any ideas why I'm getting this error? botocore.exceptions.ClientError: An error occurred (InvalidAddress) when calling the ReceiveMessage operation: The address is not valid for this endpoint.

  - name: ec2-tag-compliance-notify-only
    resource: ec2
    description: |
       Scan EC2 resources that do not meet tag compliance policies.
      - type: value
        key: "State.Name"
        op: ni
        value: ['terminated']
      - or: *tag-compliance-filters
      - type: notify
        template: general_template.html
        priority_header: 2
        subject: "Enterprise Tagging - {{ policy['resource'] }} Compliance Report! [{{ account }} - {{ region }}] ***TEST EMAIL***"
        violation_desc: "is not tag compliant. Please see Cheat Sheet Link below and fix your tags!"
        action_desc: |
          resource out of compliance. Informational only. No marking, stopping or deleting of resources.
          type: sqs


role: arn:aws:iam::{account_id}:role/cloud-custodian


2020-05-27 22:47:17,807: custodian.policy:INFO policy:ec2-tag-compliance-notify-only resource:ec2 region:ap-northeast-1 count:349 time:4.05
2020-05-27 22:47:19,742: custodian.policy:INFO policy:ec2-tag-compliance-notify-only resource:ec2 region:ap-southeast-2 count:31 time:1.84
2020-05-27 22:47:24,625: custodian.policy:INFO policy:ec2-tag-compliance-notify-only resource:ec2 region:eu-central-1 count:64 time:4.86
2020-05-27 22:47:30,105: custodian.policy:INFO policy:ec2-tag-compliance-notify-only resource:ec2 region:us-east-1 count:167 time:5.45
2020-05-27 22:47:34,732: custodian.policy:INFO policy:ec2-tag-compliance-notify-only resource:ec2 region:us-east-2 count:187 time:4.57
2020-05-27 22:47:35,449 - custodian-mailer - INFO - Downloading messages from the SQS queue.
Traceback (most recent call last):
  File "/usr/local/bin/c7n-mailer", line 11, in <module>
    load_entry_point('c7n-mailer==0.5.7', 'console_scripts', 'c7n-mailer')()
  File "/usr/local/lib/python3.8/site-packages/c7n_mailer-0.5.7-py3.8.egg/c7n_mailer/", line 253, in main
  File "/usr/local/lib/python3.8/site-packages/c7n_mailer-0.5.7-py3.8.egg/c7n_mailer/", line 117, in run
    for sqs_message in sqs_messages:
  File "/usr/local/lib/python3.8/site-packages/c7n_mailer-0.5.7-py3.8.egg/c7n_mailer/", line 54, in __next__
    response = self.aws_sqs.receive_message(
  File "/usr/local/lib/python3.8/site-packages/botocore/", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.8/site-packages/botocore/", line 635, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidAddress) when calling the ReceiveMessage operation: The address is not valid for this endpoint.
make: *** [cust-dryrun-report-prod] Error 1

When I hardcode the account number it works.

5 replies
Amarankit Srivastava
Hello team, @kapilt @jtroberts83 , any advice on how to approach (to modify codes) to achieve "Action: Detach the policies from identity: role, user, group whenever policies has <service>:?? and effect: allow, without considering resource (resource: or resource:<S3 arn>) except for Get, Describe, List* in allow block in IAM Policies​"? Many thanks
3 replies
@kapilt , the last release where gcp-audit mode is working is Any higher version - resource not loaded in traceback of cloud function with any resource.
5 replies

Hi all,
Does anyone used CC for select all s3 buckets which have turned on Versioning and don't have policy to delete old versions
I tried to write some filter like:

      - type: value
        key: Versioning.Status
        value: Enabled
      - type: value
        key: Lifecycle.Rules[].NoncurrentVersionExpiration.NoncurrentDays
        value: absent
        op: not-in

but my filter looks wrong,
how it possible to write a correct filter?

Is there anyway I can tell to custodian report command to extract out specific fields from output of "resources.json" instead default fields for a particular resource?
2 replies
Brian Bohrer
With regards to Cloud Custodian Security Group Policies, is it feasible to enforce that every ingress rule must specify a port or ports? Ingress rule created with 'all' ports would be remediated basically. Thanks!
2 replies
i am putting a policy that will look for tag: DeleteAfter: MM-DD-YY I thought I can do mark-for-op but that does seem to solve the problem, any suggestion?
3 replies
Gautami Kher
Hi Team, Is there any policy for aws S3 bucket to encrypt specific bucket? and not entire buckets in region
Jason Terlecki

When I run this policy

  - name: auto-clean-security-groups-egress
    resource: security-group
    description: |
      Remove security group internet egress at creation
        type: cloudtrail
        role: arn:aws:iam::{account_id}:role/Vid-CloudCustodianClientRole
          - source:
            event: CreateSecurityGroup
            ids: "responseElements.groupId"
            Name: "auto-clean-security-groups-remediate-egress"
            supportgroup: "CLOUD"
            service: "CloudCustodian"
            costcenter: "{varcostcenter}"
            projectcode: "{varprojectcode}"
      - type: set-permissions
          - IpProtocol: "-1"
            Cidr: ""

I get the following error:
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in IpPermissions[0]: "Cidr", must be one of: FromPort, IpProtocol, IpRanges, Ipv6Ranges, PrefixListIds, ToPort, UserIdGroupPairs

Jason Terlecki
should I be using something like this instead?
    - CidrIp: ""
Kapil Thangavelu
@jterlecki_gitlab its a straight pass through so its the same parameters that you pass to the cli/api for removing an egress permission
I'm looking to have VPC flow logs from a large number of accounts directed to a centralized logging account. I noticed that c7n-log-exporter supports kinesis for realtime export. However, I didn't see any documentation regarding how this can be implemented. Is there something out there that I can review to understand how this can best be setup?
Kapil Thangavelu
you use a custodian policy to ensure all vpcs have flow logs set to a known cloud watch log group.. and then you use tools/c7n_log_exporter to send the log groups to a centralized kinesis destination, and optionally to archive them to s3
Giulio Denardi
I was wondering: is there currently a built-in way of adding a default action for all policies?
e.g regardless of policy, I'd like to add the same notify action. So I could use a default action for that, and write it just in one place
4 replies
Hi all, for a security group, if the CIDR is for type: ingress, then in the actions set-permissions can we do SelfReference the group in the custodian policy?
7 replies
Ty Segall
Hi all. One of the security peeps on my team asked about a check for the "Instance Metadata Service Version" since it was part of the Capital One hack. Doing a quick grep on the IP address "" yielded a few hits. I'm not finding a whole lot; just wanted to make sure a check for Instance Metadata Service Version 1 vs 2 isn't already out there. :)
26 replies
Should say, grep on the Cloud Custodian source
@kapilt - Is there a way we can identify the sub-domains that are stale and not used for long time
3 replies
Can we pass filtered security group Id in actions?
3 replies
Hey all, has anyone used Athena with c7n-org generated resources.json files? The file begins with a [ and Athena is expecting { it would seem. I'd like to avoid writing a lambda if possible.
1 reply
@kapilt I fixed ./c7n_gcp/resources/ for gcp-audit mode. Place {region} instead {location_id} in static method.
5 replies
and in what file should I set scope: folder and scope_id: folder_id for multi project gcp-audit ?
2 replies
@jtroberts83/@kapilt, Need help with the following policy. In the policy below how do I replace GroupId(whatever sg's are filtered need to replace) in actions?
     - name: default-sgs
         - type: value
           key: GroupName
           value: default
           op: eq
         - type: ingress
           IpProtocol: "-1"
             - CidrIp: ""
         - type: set-permissions
           remove-ingress: matched
             -  IpPermissions:
                   FromPort: -1
                   IpProtocol: "-1"
                   ToPort: -1
                       - GroupId: '{ GroupId }'
5 replies
Curious on how to make a compound AND filter on a aws.ec2 that verifies that the AWS account (I'm using c7n-org) has a particular tag and the instance has a particular age. Can you filter on mulitple resources, and perform an action on just one?
10 replies
Hey all, I'm seeing some unexpected behavior with mugc. I've changed a bunch of policies from periodic mode to pull mode and it looks like mugc isn't cleaning up the Lambdas. Is that expected? If so, is there a flag or something I can add to have it clean up the now-outdated Lambdas? TIA!
4 replies
Dan Parsons
Is there a way via c7n-org and c7n-mailer to specify a different email address per aws account for the reports to go to?
Ideally what I'm looking for is... for each account c7n-org iterates over, email the report to both ops@mycompany and also specific_department@mycompany
Kristina Trump
@kapilt , is there away to revert back the remove-launch-permissions action in AMI
3 replies
is the latest version with ecr registry auto enable scan on push ... already released.. or still waiting...
5 replies
Hugh Saunders
Hey, is there any way to include one policy in another, or set a global vars block for all policy files? I want to set notification defaults but have policies organised into files by resource type.
3 replies
Michael Davis
@ingwarsw Thanks for GCP labeling, it also fixed my issue #4838. How about a "copy-related-tags" for GCP. Should I open an issue? And @kapilt can anyone suggest a workaround that provides this functionality?
2 replies
@kapilt I have added GCP custom resource to to get ACL's of buckets. added it to It works. But there is no notify action in output of custodian schema, only webhook for this resource. How to add notify action? I'll do a PR if u can explain me how to add notify action for resource.
11 replies
New to Cloud Custodian.... Looking though documentation. Is there anyway that GCP can leverage Cloud functions in the same (similar) manner as AWS Lambda?
6 replies
11 replies
Jimmy Grover
Is it possible to list the principal values o an SQS Q. Were trying to track down SQS Q with "*" in the principal.
30 replies
Thomas Callahan
Hello Everyone, new to Cloud Custodian. I was wondering if there is any cleanup/removal functionality? Lets say I deploy a policy that creates a lambda in 10 accounts. Is there a way to remove that policy and have it cloud custodian remove any resources it created? Or do you have to manually go clean them up?
6 replies
question on off-hours, i want to shutdown ec2 instances from 8pm - 8am, based on the time-zone, can this be accomplished by one policy or different policy, like ec2 instances used by team in India(apac-) shutdown at their night and while team is us (us-*) regions shutdown in their time
4 replies
Hey guys, sorry if this is a dumb question, but is there a way for a policy to always trigger an action? I have a lambda that I need to run periodically, and I know that I can set the periods on Cloud-Custodian, but I also need to make sure that it is triggered. I'm open to explore solutions outside of the tool, but would prefer it if it was with it
5 replies
@kapilt on the Cloud_Custodian container images, can awscli be added to image, as latest awscli breaks cloud custodian as when latest awscli installed, itupgrades botocore to latest version which is then incompatiable with boto3 version used by cloud custodian. I am looking to use awscli on container to transfer fer files to and from s3
3 replies
Hello Team, Need some help on Azure Security Group lockdown policy open to world.
@kapilt if you can take a look into it quickly!
I am getting below error, while executing policy;
2020-06-08 19:39:20,946: custodian.resources.networksecuritygroup:INFO NSG Cloudcustodiansecgrp. Creating new rule to Deny access for ports ['3389']
2020-06-08 19:39:22,316: custodian.resources.networksecuritygroup:ERROR Failed to create or update security rule for Cloudcustodiansecgrp NSG.
2020-06-08 19:39:22,421: custodian.resources.networksecuritygroup:ERROR Azure Error: SecurityRuleInvalidPriority
Message: Security rule has invalid Priority. Value provided: 90 Allowed range 100-4096.
10 replies