Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 51 additions & 21 deletions Monitoring/CloudWatch-FSx/cloudformation-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"SecurityGroupIds",
"CreateFsxServiceEndpoint",
"CreateSecretManagerEndpoint",
"CreateCloudWatchEndpoint"
"CreateCloudWatchEndpoint",
"LambdaRoleArn",
"SchedulerRoleArn"
]
},
{
Expand Down Expand Up @@ -67,6 +69,12 @@
"SnsTopicArn": {
"default": "SNS Topic ARN for CloudWatch alarms - Optional"
},
"LambdaRoleArn": {
"default": "Lambda Role ARN if you don't want this CloudFormation template to create one - Optional"
},
"SchedulerRoleArn": {
"default": "Scheduler Role ARN if you don't want this CloudFormation template to create one - Optional"
},
"SendUsage": {
"default": "Agree to Send Usage Data"
}
Expand Down Expand Up @@ -115,6 +123,16 @@
"Default": "false",
"Description": "A boolean flag indicating whether you plan to create a CloudWatch VPC endpoint inside the VPC. Set this to true if you want to create the endpoint, or false if you don't. The decision to create this endpoint depends on whether you already have this type of endpoint. If you already have one, set this to false; otherwise, set it to true."
},
"LambdaRoleArn": {
"Type": "String",
"Description": "The ARN of the IAM role that will be associated with the Lambda function when it runs.",
"Default": ""
},
"SchedulerRoleArn": {
"Type": "String",
"Description": "The ARN of the IAM role that will be associated with the Schedulers when they run.",
"Default": ""
},
"SendUsage": {
"Type": "String",
"AllowedValues": ["true", "false"],
Expand Down Expand Up @@ -159,6 +177,22 @@
}
]
},
"NeedToCreateSchedulerRole": {
"Fn::Equals": [
{
"Ref": "SchedulerRoleArn"
},
""
]
},
"NeedToCreateLambdaRole": {
"Fn::Equals": [
{
"Ref": "LambdaRoleArn"
},
""
]
},
"NeedToSendUsage": {
"Fn::Equals": [
{
Expand Down Expand Up @@ -242,6 +276,7 @@
},
"LambdaRole": {
"Type": "AWS::IAM::Role",
"Condition": "NeedToCreateLambdaRole",
"Properties": {
"RoleName": {
"Fn::Sub": [
Expand Down Expand Up @@ -344,12 +379,10 @@
]
}
},
"Role": {
"Fn::GetAtt": [
"LambdaRole",
"Arn"
]
},
"Role": {"Fn::If": ["NeedToCreateLambdaRole",
{"Fn::GetAtt": [ "LambdaRole", "Arn" ]},
{"Ref": "LambdaRoleArn"}
]},
"VpcConfig": {
"SecurityGroupIds": {
"Ref": "SecurityGroupIds"
Expand Down Expand Up @@ -378,6 +411,7 @@
},
"SchedulerRole": {
"Type": "AWS::IAM::Role",
"Condition": "NeedToCreateSchedulerRole",
"Properties": {
"RoleName": {
"Fn::Sub": [
Expand Down Expand Up @@ -418,7 +452,7 @@
}
}]
}
},
},
"MetricsScheduler": {
"Type": "AWS::Scheduler::Schedule",
"Properties": {
Expand All @@ -434,12 +468,10 @@
"Arn"
]
},
"RoleArn": {
"Fn::GetAtt": [
"SchedulerRole",
"Arn"
]
},
"RoleArn": {"Fn::If": ["NeedToCreateSchedulerRole",
{"Fn::GetAtt": [ "SchedulerRole", "Arn" ]},
{"Ref": "SchedulerRoleArn"}
]},
"Input": {
"Fn::ToJsonString": {
"action": "putMetricsCommand",
Expand Down Expand Up @@ -467,12 +499,10 @@
"Arn"
]
},
"RoleArn": {
"Fn::GetAtt": [
"SchedulerRole",
"Arn"
]
},
"RoleArn": {"Fn::If": ["NeedToCreateSchedulerRole",
{"Fn::GetAtt": [ "SchedulerRole", "Arn" ]},
{"Ref": "SchedulerRoleArn"}
]},
"Input": {
"Fn::ToJsonString": {
"action": "manageAlarmsCommand",
Expand Down Expand Up @@ -1436,4 +1466,4 @@
}
}
}
}
}