I have an event bus and created an event rule that forwards events to an SQS queue. Now I enabled encryption for my queue, using the default amazon-managed key (alias/aws/sqs).
After enabling encryption, the events are not forwarded anymore. Researching the AWS docs I could only find info about using a CMK for encryption, but no info regarding the amazon managed key.
I guess it's a permission issue, but not sure. This is my event rule and the access policy
queueCreateInvoiceEvent:
Type: AWS::Events::Rule
DependsOn: [myQueue]
Properties:
Description: Forward INVOICE_CREATED event to SQS queue
EventBusName: ${self:custom.eventBus.name}
EventPattern: { "detail-type": ["INVOICE_CREATED"] }
Name: ${self:service.name}-${self:provider.stage}-buffer-invoice-created-event
State: ENABLED
Targets:
- Id: myQueue
Arn:
Fn::GetAtt: [myQueue, Arn]
createReceiptQueueAccessPolicy:
Type: AWS::SQS::QueuePolicy
DependsOn: [queueCreateInvoiceEvent, myQueue]
Properties:
Queues:
- { Ref: createReceiptQueue }
PolicyDocument:
Id: EventBridgeSqsAccessPolicy
Version: "2012-10-17"
Statement:
- Sid: Allow-User-SendMessage
Effect: Allow
Principal:
Service: "events.amazonaws.com"
Action:
- sqs:SendMessage
Resource:
- Fn::GetAtt: ["myQueue", "Arn"]
Condition:
ArnEquals:
aws:SourceArn:
- Fn::GetAtt: ["queueCreateInvoiceEvent", "Arn"]