All Projects → cloud-custodian → Cloud Custodian

cloud-custodian / Cloud Custodian

Licence: apache-2.0
Rules engine for cloud security, cost optimization, and governance, DSL in yaml for policies to query, filter, and take actions on resources

Programming Languages

python
139335 projects - #7 most used programming language
go
31211 projects - #10 most used programming language
HCL
1544 projects
Jinja
831 projects
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to Cloud Custodian

Pulumi
Pulumi - Developer-First Infrastructure as Code. Your Cloud, Your Language, Your Way 🚀
Stars: ✭ 10,887 (+177.31%)
Mutual labels:  aws, serverless, cloud, azure, gcp, cloud-computing
Grant
OAuth Proxy
Stars: ✭ 3,509 (-10.62%)
Mutual labels:  aws, serverless, azure, lambda, gcp
Komiser
☁️ Cloud Environment Inspector 👮🔒 💰
Stars: ✭ 2,684 (-31.64%)
Mutual labels:  aws, serverless, azure, lambda, gcp
Cloudquery
cloudquery transforms your cloud infrastructure into SQL or Graph database for easy monitoring, governance and security.
Stars: ✭ 1,300 (-66.89%)
Mutual labels:  aws, azure, gcp, cloud-computing, compliance
Seldon Server
Machine Learning Platform and Recommendation Engine built on Kubernetes
Stars: ✭ 1,435 (-63.45%)
Mutual labels:  aws, cloud, azure, gcp
Arvados
An open source platform for managing and analyzing biomedical big data
Stars: ✭ 274 (-93.02%)
Mutual labels:  aws, cloud, azure, gcp
Aws Auto Cleanup
Open-source application to programmatically clean your AWS resources based on a whitelist and time to live (TTL) settings
Stars: ✭ 276 (-92.97%)
Mutual labels:  aws, serverless, cloud, lambda
Externalsecret Operator
An operator to fetch secrets from cloud services and inject them in Kubernetes
Stars: ✭ 177 (-95.49%)
Mutual labels:  aws, cloud, azure, gcp
Cloudsploit
Cloud Security Posture Management (CSPM)
Stars: ✭ 1,338 (-65.92%)
Mutual labels:  aws, cloud, azure, gcp
Node Lambda Log
Basic logging mechanism for Node 6.10+ Lambda Functions
Stars: ✭ 115 (-97.07%)
Mutual labels:  aws, serverless, cloud, lambda
Scoutsuite
Multi-Cloud Security Auditing Tool
Stars: ✭ 3,803 (-3.13%)
Mutual labels:  aws, cloud, azure, gcp
Docker Android
Android in docker solution with noVNC supported and video recording
Stars: ✭ 4,042 (+2.95%)
Mutual labels:  aws, cloud, azure, gcp
Learning Cloud
List of resources - courses, sample code, articles and screencasts for learning AWS, Azure, GCP and Alibaba Cloud
Stars: ✭ 100 (-97.45%)
Mutual labels:  aws, cloud, azure, gcp
Awstaghelper
AWS bulk tagging tool
Stars: ✭ 98 (-97.5%)
Mutual labels:  aws, cloud, lambda, cloud-computing
Aws Auto Remediate
Open source application to instantly remediate common security issues through the use of AWS Config
Stars: ✭ 191 (-95.13%)
Mutual labels:  aws, serverless, cloud, lambda
Checkov
Prevent cloud misconfigurations during build-time for Terraform, Cloudformation, Kubernetes, Serverless framework and other infrastructure-as-code-languages with Checkov by Bridgecrew.
Stars: ✭ 3,572 (-9.02%)
Mutual labels:  aws, azure, gcp, compliance
Pulumi Aws
An Amazon Web Services (AWS) Pulumi resource package, providing multi-language access to AWS
Stars: ✭ 169 (-95.7%)
Mutual labels:  aws, cloud, lambda, cloud-computing
Infracost
Cloud cost estimates for Terraform in pull requests💰📉 Love your cloud bill!
Stars: ✭ 4,505 (+14.75%)
Mutual labels:  aws, cloud, gcp, azure
Awesome Aws
A curated list of awesome Amazon Web Services (AWS) libraries, open source repos, guides, blogs, and other resources. Featuring the Fiery Meter of AWSome.
Stars: ✭ 9,895 (+152.04%)
Mutual labels:  aws, serverless, cloud, lambda
Aws Lambda Fastify
Insipired by aws-serverless-express to work with Fastify with inject functionality.
Stars: ✭ 190 (-95.16%)
Mutual labels:  aws, serverless, cloud, lambda

Cloud Custodian

Cloud Custodian Logo


CI CII Best Practices

Cloud Custodian is a rules engine for managing public cloud accounts and resources. It allows users to define policies to enable a well managed cloud infrastructure, that's both secure and cost optimized. It consolidates many of the adhoc scripts organizations have into a lightweight and flexible tool, with unified metrics and reporting.

Custodian can be used to manage AWS, Azure, and GCP environments by ensuring real time compliance to security policies (like encryption and access requirements), tag policies, and cost management via garbage collection of unused resources and off-hours resource management.

Custodian policies are written in simple YAML configuration files that enable users to specify policies on a resource type (EC2, ASG, Redshift, CosmosDB, PubSub Topic) and are constructed from a vocabulary of filters and actions.

It integrates with the cloud native serverless capabilities of each provider to provide for real time enforcement of policies with builtin provisioning. Or it can be run as a simple cron job on a server to execute against large existing fleets.

Cloud Custodian is a CNCF Sandbox project, lead by a community of hundreds of contributors.

Features

  • Comprehensive support for public cloud services and resources with a rich library of actions and filters to build policies with.
  • Supports arbitrary filtering on resources with nested boolean conditions.
  • Dry run any policy to see what it would do.
  • Automatically provisions serverless functions and event sources ( AWS CloudWatchEvents, AWS Config Rules, Azure EventGrid, GCP AuditLog & Pub/Sub, etc)
  • Cloud provider native metrics outputs on resources that matched a policy
  • Structured outputs into cloud native object storage of which resources matched a policy.
  • Intelligent cache usage to minimize api calls.
  • Supports multi-account/subscription/project usage.
  • Battle-tested - in production on some very large cloud environments.

Links

Quick Install

$ python3 -m venv custodian
$ source custodian/bin/activate
(custodian) $ pip install c7n

Usage

The first step to using Cloud Custodian is writing a YAML file containing the policies that you want to run. Each policy specifies the resource type that the policy will run on, a set of filters which control resources will be affected by this policy, actions which the policy with take on the matched resources, and a mode which controls which how the policy will execute.

The best getting started guides are the cloud provider specific tutorials.

As a quick walk through, below are some sample policies for AWS resources.

  1. will enforce that no S3 buckets have cross-account access enabled.
  2. will terminate any newly launched EC2 instance that do not have an encrypted EBS volume.
  3. will tag any EC2 instance that does not have the follow tags "Environment", "AppId", and either "OwnerContact" or "DeptID" to be stopped in four days.
policies:
 - name: s3-cross-account
   description: |
     Checks S3 for buckets with cross-account access and
     removes the cross-account access.
   resource: aws.s3
   region: us-east-1
   filters:
     - type: cross-account
   actions:
     - type: remove-statements
       statement_ids: matched

 - name: ec2-require-non-public-and-encrypted-volumes
   resource: aws.ec2
   description: |
    Provision a lambda and cloud watch event target
    that looks at all new instances and terminates those with
    unencrypted volumes.
   mode:
    type: cloudtrail
    role: CloudCustodian-QuickStart
    events:
      - RunInstances
   filters:
    - type: ebs
      key: Encrypted
      value: false
   actions:
    - terminate

 - name: tag-compliance
   resource: aws.ec2
   description: |
     Schedule a resource that does not meet tag compliance policies to be stopped in four days. Note a separate policy using the`marked-for-op` filter is required to actually stop the instances after 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

You can validate, test, and run Cloud Custodian with the example policy with these commands:

# Validate the configuration (note this happens by default on run)
$ custodian validate policy.yml

# Dryrun on the policies (no actions executed) to see what resources
# match each policy.
$ custodian run --dryrun -s out policy.yml

# Run the policy
$ custodian run -s out policy.yml

You can run Cloud Custodian via Docker as well:

# Download the image
$ docker pull cloudcustodian/c7n
$ mkdir output

# Run the policy
#
# This will run the policy using only the environment variables for authentication
$ docker run -it \
  -v $(pwd)/output:/home/custodian/output \
  -v $(pwd)/policy.yml:/home/custodian/policy.yml \
  --env-file <(env | grep "^AWS\|^AZURE\|^GOOGLE") \
  cloudcustodian/c7n run -v -s /home/custodian/output /home/custodian/policy.yml

# Run the policy (using AWS's generated credentials from STS)
#
# NOTE: We mount the ``.aws/credentials`` and ``.aws/config`` directories to
# the docker container to support authentication to AWS using the same credentials
# credentials that are available to the local user if authenticating with STS.

$ docker run -it \
  -v $(pwd)/output:/home/custodian/output \
  -v $(pwd)/policy.yml:/home/custodian/policy.yml \
  -v $(cd ~ && pwd)/.aws/credentials:/home/custodian/.aws/credentials \
  -v $(cd ~ && pwd)/.aws/config:/home/custodian/.aws/config \
  --env-file <(env | grep "^AWS") \
  cloudcustodian/c7n run -v -s /home/custodian/output /home/custodian/policy.yml

The custodian cask tool is a go binary that provides a transparent front end to docker that mirors the regular custodian cli, but automatically takes care of mounting volumes.

Consult the documentation for additional information, or reach out on gitter.

Cloud Provider Specific Help

For specific instructions for AWS, Azure, and GCP, visit the relevant getting started page.

Get Involved

  • GitHub - (This page)
  • Gitter - Real time chat if you're looking for help
  • Mailing List - Our project mailing list, subscribe here for important project announcements, feel free to ask questions
  • Reddit - Our subreddit
  • StackOverflow - Q&A site for developers, we keep an eye on the cloudcustodian tag
  • YouTube Channel - We're working on adding tutorials and other useful information, as well as meeting videos

Community Resources

We have a regular community meeting that is open to all users and developers of every skill level. Joining the mailing list will automatically send you a meeting invite. See the notes below for more technical information on joining the meeting.

Additional Tools

The Custodian project also develops and maintains a suite of additional tools here https://github.com/cloud-custodian/cloud-custodian/tree/master/tools:

  • Org: Multi-account policy execution.

  • PolicyStream: Git history as stream of logical policy changes.

  • Salactus: Scale out s3 scanning.

  • Mailer: A reference implementation of sending messages to users to notify them.

  • Trail Creator: Retroactive tagging of resources creators from CloudTrail

  • TrailDB: Cloudtrail indexing and time series generation for dashboarding.

  • LogExporter: Cloud watch log exporting to s3

  • Cask: Easy custodian exec via docker

  • Guardian: Automated multi-account Guard Duty setup

  • Omni SSM: EC2 Systems Manager Automation

  • Mugc: A utility used to clean up Cloud Custodian Lambda policies that are deployed in an AWS environment.

Contributing

See https://cloudcustodian.io/docs/contribute.html

Security

If you've found a security related issue, a vulnerability, or a potential vulnerability in Cloud Custodian please let the Cloud Custodian Security Team know with the details of the vulnerability. We'll send a confirmation email to acknowledge your report, and we'll send an additional email when we've identified the issue positively or negatively.

Code of Conduct

This project adheres to the CNCF Code of Conduct

By participating, you are expected to honor this code.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].