Description
I encountered a deployment failure when deploying this template using AWS CloudFormation StackSets.
The error occurs because the generated name for AWS::Events::Rule exceeds the service limit of 64 characters.
This happens particularly when the StackSet name itself is long, as the AWS::Events::Rule resource in the template inherits the name from the SQS queue (SQSConfigRecorder), which allows up to 80 characters, causing a mismatch with the EventBridge limit.
Error Log
ResourceLogicalId: ProducerEventTrigger
ResourceType: AWS::Events::Rule
ResourceStatusReason: Resource handler returned message: "1 validation error detected: Value 'StackSet-master-config-exclusion-cfn-bb504b54-5f7-SQSConfigRecorder-PgvEuTNmRU9F' at 'name' failed to satisfy constraint: Member must have length less than or equal to 64 (Service: EventBridge, Status Code: 400 ...)"
Root Cause
In the ProducerEventTrigger resource, the Name property is set to retrieve the SQS Queue Name:
ProducerEventTrigger:
Type: AWS::Events::Rule
Properties:
# ...
Name: !GetAtt SQSConfigRecorder.QueueName <-- CAUSE
When deployed via StackSets, CloudFormation automatically appends prefixes (e.g., StackSet-xxx-...) and random strings to the SQS queue name. SQS allows up to 80 characters, but EventBridge Rules are strictly limited to 64 characters. In my case, the generated SQS name was 86 characters long, resulting in the validation error.
Suggested Fix
To ensure the name stays within the 64-character limit, I recommend explicitly specifying a shorter, fixed name or using a truncated naming logic for the EventBridge Rule, rather than inheriting the full SQS queue name.
Example Fix:
ProducerEventTrigger:
Type: AWS::Events::Rule
Properties:
# Use a fixed short name or generate a shorter custom name
Name: "ct-config-recorder-trigger"
# ...
Description
I encountered a deployment failure when deploying this template using AWS CloudFormation StackSets.
The error occurs because the generated name for
AWS::Events::Ruleexceeds the service limit of 64 characters.This happens particularly when the StackSet name itself is long, as the
AWS::Events::Ruleresource in the template inherits the name from the SQS queue (SQSConfigRecorder), which allows up to 80 characters, causing a mismatch with the EventBridge limit.Error Log
Root Cause
In the
ProducerEventTriggerresource, theNameproperty is set to retrieve the SQS Queue Name:When deployed via StackSets, CloudFormation automatically appends prefixes (e.g.,
StackSet-xxx-...) and random strings to the SQS queue name. SQS allows up to 80 characters, but EventBridge Rules are strictly limited to 64 characters. In my case, the generated SQS name was 86 characters long, resulting in the validation error.Suggested Fix
To ensure the name stays within the 64-character limit, I recommend explicitly specifying a shorter, fixed name or using a truncated naming logic for the EventBridge Rule, rather than inheriting the full SQS queue name.
Example Fix: