跳至內容

How to properly import AWS::Events::Rule in CloudFormation?

0

I have the cloudformation set up like follow:

  Rulecfa4853400:
    UpdateReplacePolicy: "Retain"
    DeletionPolicy: "Retain"
    Type: AWS::Events::Rule
    DependsOn:
      - EventsEventBus00hy3Ab
    Properties:
      Name: SomeRuleName
      EventPattern: >-
        {}
      State: ENABLED
      EventBusName: SomeBus
      Targets:
        - Id: abc
          Arn:
            Fn::Sub: >-
              arn:${AWS::Partition}:sqs:${AWS::Region}:${AWS::AccountId}:abc
          DeadLetterConfig:
            Arn:
              Fn::Sub: >-
                arn:${AWS::Partition}:sqs:${AWS::Region}:${AWS::AccountId}:abc-DLQ

But when I try to import using the template above, I get the following in the Import Resource step:

Enter image description here

Enter image description here

This gives me the impression that it wants to know the exact resource to import from, but I've already configured the 'Properties.Name' that matches exactly as specified in SomeBus

Also tried just ignoring it and proceeding, then I saw the following error, which implies that it's not recognizing the 'name'

Enter image description here

Tried again by removing the Properties.Name and setting Properties.Arn and all of them still ask for Arn, which I'm not sure why.

What am I missing?

Thank you

已提問 2 年前檢視次數 287 次

1 個回答
0
已接受的答案

You'll need to provide the ARN (Amazon Resource Name) of the existing EventBridge rule. It always has to be specified for import operations, even if it appears to be possible to derive from the values included in the template.

You can find the rule ARN in the EventBridge console under "Rules" by opening the individual rule details. It should be of the form:

arn:aws:events:<region>:000000000000:rule/SomeRuleName
專家

已回答 2 年前

專家

已審閱 2 年前

  • Thank you! That was indeed the problem

    The confusing part is that I have like 8 rules to be imported, and I actually already tried to use the ARN as the import tool requested

    However, whilst I was copying like ARNs for the 5 rules, the input field will be all 'reset' and they become empty input field again, which gave me the impression that ARN must be left empty

    Is it also the case for you or anyone?

    Removing all rules and importing only 2 rules, so I could copy/paste ARN quickly enough before the fields 'reset' solved the problem.

    I guess I will repeat this process for the remaining 6 rules, but I hardly imagine this is a normal behavior.

    Anyways, thank you for the help!

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。