aws / aws/aws-cdk

aws_events_targets: message_attributes

Open
#35,875 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-events-targets effort/medium feature-request needs-cfn p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Support setting message_attributes in aws_events_targets.SnsTopic
https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_events_targets/SnsTopic.html

### Use Case

I want to have an eventbridge cron schedule send a message to a SNS topic. I can use https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.aws_events_targets/SnsTopic.html but this does not seem to support the specification of message_attributes.

In boto3 I could do
```
sns = boto3.client('sns')
response = sns.publish(
TopicArn='mytopic',
Message=json.dumps({"foo": "bar"}),
MessageAttributes={ 'eventType': {'DataType': 'String', 'StringValue': 'status'})
```

But aws_events_targets.SnsTopic does not provide a message_attributes parameter
eg
```
rule.add_target(
targets.SnsTopic(
topic,
message=events.RuleTargetInput.from_object({
"default": "Event received from EventBridge"}),....
```

### Proposed Solution

_No response_

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### AWS CDK Library version (aws-cdk-lib)

2.216.0

### AWS CDK CLI version

2.1029.2

### Environment details (OS name and version, etc.)

Linux

Contributor guide

Open the contributing guide

Research direction

Start at the aws_events_targets.SnsTopic entry point and compare its current target options with the boto3 SNS publish example, focusing on MessageAttributes. Trace how the EventBridge target is configured and identify the corresponding target tests; done means callers can provide message_attributes and the resulting SNS publish request includes them.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.