CloudTrail을 사용할 수있는 CloudFormation 스크립트를 만들고 새 S3 버킷을 생성하여 사용하거나 현재 사용중인 버킷을 사용할 수있는 옵션을 사용자에게 제공하려고합니다. S3 버킷. 나는 AWS를 처음 사용하기 때문에 조금 잃어 버렸습니다. 지금까지 조건문 등을 추가하지 않고서 찍은 수정 된 코드가 있습니다.AWS : Cloudformation 스크립트가 CloudTrail 용 S3 버킷을 조건부에 따라 작성합니다.
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "CloudTrail",
"Parameters" : {
"UseExisitingBucket" : {
"Description" : "Yes/No",
"Default" : "Yes",
"Type" : "String",
"AllowedValues" : [ "yes", "no"]
},
"BucketName" : {
"Description" : "Name of the S3 bucket.",
"Type" : "String"
},
"TopicName" : {
"Description" : "Name of the SNS topic.",
"Type" : "String",
"Default" : ""
},
"IncludeGlobalServiceEvents" : {
"Description" : "Indicates whether the trail is publishing events from global services, such as IAM, to the log files.",
"Type" : "String",
"Default" : "false",
"AllowedValues" : [
"true",
"false"
]
}
},
"Conditions" : {
"UseSNSTopic" : {
"Fn::Not" : [
{
"Fn::Equals" : [
{
"Ref" : "TopicName"
},
""
]
}
]
}
},
"Resources" : {
"Trail" : {
"Type" : "AWS::CloudTrail::Trail",
"Properties" : {
"IncludeGlobalServiceEvents" : {
"Ref" : "IncludeGlobalServiceEvents"
},
"S3BucketName" : {
"Ref" : "BucketName"
},
"SnsTopicName" : {
"Fn::If" : [
"UseSNSTopic",
{
"Ref" : "TopicName"
},
{
"Ref" : "AWS::NoValue"
}
]
},
"IsLogging" : true
}
}
}
}
감사합니다. – flyingcars34