【问题标题】:AWS config for ec2, s3, loadbalancer using troposphere使用对流层的 ec2、s3、负载均衡器的 AWS 配置
【发布时间】:2019-07-14 07:27:47
【问题描述】:

我正在尝试为我的实例和存储桶配置 AWS::Config

但我在对流层中没有找到任何参考,

我如何创建ConfigRule

我有 cloudformation 中的配置模板。

AWSConfig = t.add_resource(
config.ConfigRule(
    'ConfigRule',
    ConfigRuleName=Client+'S3BucketRule',
    Description='S3 Public Read Prohibited Bucket Rule',
    InputParameters='{}',
    MaximumExecutionFrequency=config.TWELVE_HOURS,
    Scope=config.Scope(
        ComplianceResourceId=Ref(LogBucket),
        ComplianceResourceTypes=['AWS::S3::Bucket'],
    ),
    Source=config.Source(
        Owner='AWS',
        SourceIdentifier='S3_BUCKET_PUBLIC_READ_PROHIBITED',
        ),
    )
)

【问题讨论】:

    标签: amazon-web-services amazon-s3 amazon-ec2 amazon-cloudformation troposphere


    【解决方案1】:

    你可以在这里找到相关的资源定义:

    https://github.com/cloudtools/troposphere/blob/master/troposphere/config.py#L56

    请注意,一般来说,对流层会尝试成为 Cloudformation 资源/参数的 1:1 映射。所以如果 Cloudformation 资源是AWS::Config::ConfigRule,那么你几乎总能猜到相关的对流层资源导入是from troposphere.config import ConfigRule

    希望有帮助!

    【讨论】:

    • 谢谢@phobologic 但是你能告诉我如何配置至少一个资源吗?我试过这个:config = t.add_resource( config.ConfigRule( 'ConfigRule', ConfigRuleName=Client+'AccessConfigRule', Description='Keep track of Modification for AWS service', InputParameters='', MaximumExecutionFrequency='', Scope='', Source='', ) )我该怎么做!
    • 抱歉,我不确定您的要求是什么 - 是否无法正常工作?有错误信息吗?实际上,我并不是很了解 ConfigRule,但不知道什么对您不起作用/您到底想做什么,不知道我能提供什么帮助!
    • 我已经更新了代码,现在看到我想为我的资源配置 AWS::Config,比如 s3、ec2 实例负载均衡器等,但我被困在这里如何添加 configRule每个资源。
    猜你喜欢
    • 2018-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-28
    • 2021-03-02
    • 1970-01-01
    • 1970-01-01
    • 2019-11-22
    相关资源
    最近更新 更多