当前位置: 首页 > 软件库 > 云计算 > Serverless 系统 >

cloud-custodian

授权协议 Apache-2.0 License
开发语言 JavaScript
所属分类 云计算、 Serverless 系统
软件类型 开源软件
地区 不详
投 递 者 西门靖琪
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Cloud Custodian

Cloud Custodian Logo


CI

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

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

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

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

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

Features

  • Comprehensive support for public cloud services and resources with arich library of actions and filters to build policies with.
  • Supports arbitrary filtering on resources with nested booleanconditions.
  • Dry run any policy to see what it would do.
  • Automatically provisions serverless functions and event sources (AWS CloudWatchEvents, AWS Config Rules, Azure EventGrid, GCPAuditLog & Pub/Sub, etc)
  • Cloud provider native metrics outputs on resources that matched apolicy
  • Structured outputs into cloud native object storage of whichresources 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 filecontaining the policies that you want to run. Each policy specifiesthe resource type that the policy will run on, a set of filters whichcontrol resources will be affected by this policy, actions which the policywith take on the matched resources, and a mode which controls whichhow 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" tobe 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 casktool is a go binarythat provides a transparent front end to docker that mirors the regularcustodian 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 additionaltools herehttps://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 apotential vulnerability in Cloud Custodian please let the CloudCustodian Security Team know withthe details of the vulnerability. We'll send a confirmation email toacknowledge your report, and we'll send an additional email when we'veidentified 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.

  • 这一逻辑还是很复杂。 不要和open-vm-tools同时使用 open-vm-tools 会在customization的最后做一次reboot,影响cloud-init的执行。 目录结构 cloudinit/sources 这个目录下存放着解析各类数据源的类,基类是:sources.DataSource cloudinit/sources/DataSourceOVF.py OVF格式数据的解析

  • VCAP Cloud Controller Design ============================ Overview -------- This version of the Cloud Controller is being redone from the ground up. While we are generally not in favor of wholesale re

  • conf包下 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xmlns:context="http://www.spring

 相关资料
  • Cloud Custodian 是一个用于 AWS 资源管理的规则引擎。允许用户通过图表、格式化输出制定策略来增强云资源的管理。包含很多特别的脚本,这是一个轻量级而且灵活的工具。 用户可以通过它来管理 AWS 环境,确保安全策略、asg 以及无用资源垃圾收集策略被正确使用,降低资源管理的成本。 可以使用简单的 YAML 配置文件来编写 Custodian 策略和指定资源类型( (ec2, asg,

  • Cloudfoundry的Spring Cloud可以轻松地在Cloud Foundry(平台即服务)中运行 Spring Cloud应用程序 。Cloud Foundry有一个“服务”的概念,它是“绑定”到应用程序的中间件,本质上为其提供包含凭据的环境变量(例如,用于服务的位置和用户名)。 spring-cloud-cloudfoundry-web项目为Cloud Foundry中的webapp

  • 我正在构建一个以谷歌云作为后端的移动应用程序。它存储关于餐馆的信息,包括他们的菜单。我需要根据菜单项和地理位置进行搜索。 我对使用哪种谷歌云解决方案相当困惑。最初,我打算使用Google App Engine和Cloud Datastore来存储数据,但后来发现,它不支持地理定位搜索,即使我使用App Engine搜索api,我也不会得到“Like”文本搜索。关于使用云SQL,我担心它的价格。我也

  • 我的索引中有这个代码。当我向云firestore创建数据时,其他用户会收到一个通知。但这不是工作 const函数=需要('Firebase函数'); const admin=需要('Firebase管理'); 管理初始化EAPP();

  • Google Cloud Bigtable和Google Cloud Datastore/App Engine Datastore有什么区别,主要的实际优势/劣势是什么?AFAIK云数据存储构建在BigTable之上。

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智能路由,微代理,控制总线)。分布式系统的协调导致了样板模式, 使用Spring Cloud开发人员可以快速地支持实现这些模式的服务和应用程序。他们将在任何分布式环境中运行良好,包括开发人员自己的笔记本电脑,裸机数据中心,以及Cloud Foundry等托管平台。