我试图每2小时从CLoudwatch触发一个AWS Task-schedul,它将执行一些操作。
下面是我的Cloudformation模板
TaskSchedule:
Type: "AWS::Events::Rule"
DeletionPolicy: Delete
Properties:
Description: >
Run every two hours.
ScheduleExpression: !Ref TaskRate #rate(1 day) #cron (15 10 * * ? *) #(0 0 * * *) #!Ref LambdaRate
State: ENABLED
#Targets:
# - Arn: !Ref ecsCluster.Arn #!Sub ${TaskDefinitionDaily.Arn}
# Id: TaskSchedule
# EcsParameters:
# TaskDefinitionArn: !Ref TaskDefinitionDaily
# TaskCount: 1
# LaunchType: 'FARGATE'
# PlatformVersion: 'LATEST'
Targets:
- Id: 'ECSTarget'
Arn: !Ref ecsCluster.Arn #!Sub ${TaskDefinitionDaily.Arn}
EcsParameters:
TaskCount: 1
TaskDefinitionArn: !Ref 'TaskDefinitionDaily'
现在,当我尝试运行上述Cloudformation模板时,出现以下错误提示。我是CFT的新手,不知道是什么原因造成的。
Provided Arn is not in correct format. (Service: AmazonCloudWatchEvents; Status Code: 400; Error Code: ValidationException;
请让我知道我在这里可能做错了什么。
答案 0 :(得分:2)
您正在尝试访问Arn
的{{1}}属性,但是您正在使用ecsCluster
进行访问。这行不通。您必须使用!Ref
来接收属性。
尝试以下
!GetAtt