Fork me on GitHub
#aws
<
2022-07-21
>
Drew Verlee02:07:08

Does anyone know of a wider aws community to ask questions in? I'm trying reddit and it's been hit or mis. I don't want to flood the channel here either. (he says as he asks another question 😕 ) In a https://docs.amazonaws.cn/en_us/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-ecsparameters.html with a ec2 (fargate) https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutTargets.html what resource i'm i supposed to point at for the ARN? In the rule docs we get this example which might be informative

MyEventsRule:
  Type: AWS::Events::Rule
  Properties:
    Description: Events Rule with EcsParameters
    EventPattern:
      source:
        - aws.ec2
      detail-type:
        - EC2 Instance State-change Notification
      detail:
        state:
          - stopping
    ScheduleExpression: rate(15 minutes)
    State: DISABLED
    Targets:
      - Arn: !GetAtt 
          - MyCluster #<------- I assume this means i'm supposed to point at the 'AWS::ECS::Cluster' that has the 'AWS::ECS::Service' that has the 'task defination i reference below?'. 
          - Arn 
        RoleArn: !GetAtt 
          - ECSTaskRole
          - Arn
        Id: Id345
        EcsParameters:
          TaskCount: 1
          TaskDefinitionArn: !Ref MyECSTask
If my comment (# <--) midway in the cf is correct, then why does the Events::Rule need both the cluster and the task definition referenced? What does providing the ARN do? The https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-arn for the arn just say: "The Amazon Resource Name (ARN) of the target." I feel like this kind of thing should be obvious, maybe is obvious to someone that has been around a bit, but i fee like i just circled the internet and came up short.

Drew Verlee03:07:17

stackoverflow is probably one place for this kind of thing.

Drew Verlee03:07:50

here is a https://kennyballou.com/blog/2019/10/aws-ecs-events-target-input/index.html from 2019 (basically the stone age) and a recent https://stackoverflow.com/questions/70735649/aws-cli-events-put-targets-ecsparameters-structure. Yea, they also target the cluster. I guess i'll just turn off my brain and accept that it has to be the cluster without any clue why.

Drew Verlee03:07:45

maybe all the cool kids use event bridge instead of directly to the service. I have no idea why that would be useful in my case but maybe it's better described.

Leaf Garland06:07:37

The AWS docs page you posted says that this page lists the resources that can be targets https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutTargets.html

Drew Verlee12:07:14

Yep. The church one in my case is the ecs task. Which means the arm should be the cluster of the task. Essentially the outer most layer. Can't find any docs on why. But it's ok, i just need to put it together. :)

Benjamin14:07:58

What's wrong with asking here? The answers might be as a reference for others and in tge worst case nobody knows.