Passer au contenu

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

1 réponse
0
Réponse acceptée

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
EXPERT

répondu il y a 2 ans

EXPERT

vérifié il y a 2 ans

  • 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!

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.