gpt4 book ai didi

aws-cloudformation - 如何将实时日志附加到 CloudFormation 中的分配

转载 作者:行者123 更新时间:2023-12-03 07:12:13 25 4
gpt4 key购买 nike

我已经创建了实时日志记录配置。但是,我找不到如何将其附加到 CloudFront 发行版。用于创建实时日志记录的 CloudFront 模板是:

KinesisDataStream:
Type: AWS::Kinesis::Stream
Properties:
Name: my-stream
RetentionPeriodHours: 24
ShardCount: 1
RealTimeLogggingRole:
Type: AWS::IAM::Role
Properties:
Tags:
- Key: Name
Value: my-role
Path: "/"
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action: sts:AssumeRole
Principal:
Service: cloudfront.amazonaws.com
Policies:
- PolicyName: po-real-time-logging-policy
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- kinesis:DescribeStreamSummary
- kinesis:DescribeStream
- kinesis:PutRecord
- kinesis:PutRecords
Resource:
- !GetAtt KinesisDataStream.Arn
RealTimeLoggging:
Type: AWS::CloudFront::RealtimeLogConfig
Properties:
Name: my-logging
SamplingRate: 100
Fields:
- timestamp
- c-ip
- cs-host
- cs-uri-stem
- cs-headers
EndPoints:
- StreamType: Kinesis
KinesisStreamConfig:
RoleArn: !GetAtt RealTimeLogggingRole.Arn
StreamArn: !GetAtt KinesisDataStream.Arn
CloudFrontDistribution:
Type: AWS::CloudFront::Distribution
...

我可以将它附加到 GUI 的发行版上:

enter image description here

但我找不到如何使用 CloudFormation 执行此操作?

最佳答案

您必须更新您的AWS::CloudFront::Distribution DefaultCacheBehavior并设置RealtimeLogConfigArn :

RealtimeLogConfigArn: !Ref RealTimeLoggging

关于aws-cloudformation - 如何将实时日志附加到 CloudFormation 中的分配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67174490/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com