- Newest
- Most votes
- Most comments
It seems like you're encountering an issue with using a shared phone number from another account in AWS End User Messaging SMS. There are a few things to consider that might help resolve your problem:
-
Resource Identification: When using shared resources, including phone numbers, you must use the full Amazon Resource Name (ARN) of the resource. This is crucial when working with resources shared across accounts.
-
API/SDK Usage: While you can see the shared resource using the CLI, it's important to note that shared resources can only be used through the AWS CLI or the AWS End User Messaging SMS and Voice v2 API. The Java SDK you're using (software.amazon.awssdk:pinpoint:2:20.136) might not be compatible with shared resources or the latest End User Messaging SMS features.
-
Origination Identity: When sending an SMS, make sure you're specifying the OriginationIdentity correctly. For a shared phone number, you should use the full ARN of the phone number, not just the phone number itself.
-
Permissions: Ensure that the IAM role or user in your development account has the necessary permissions to use the shared phone number. This includes permissions granted through Resource Access Manager as well as any required IAM policies.
-
API Version: The error message you're receiving suggests you might be using an older version of the Pinpoint API. The End User Messaging SMS service uses a newer API (pinpoint-sms-voice-v2) which has different methods for sending SMS messages.
To resolve this issue:
- Update your code to use the latest AWS SDK for Java that supports the pinpoint-sms-voice-v2 API.
- When sending the SMS, use the full ARN of the shared phone number as the OriginationIdentity.
- Double-check the permissions in your development account to ensure they allow using the shared phone number.
- If possible, try sending a message using the AWS CLI with the shared phone number to confirm it works outside of your Java application.
If the issue persists after making these changes, you may need to contact AWS support for further assistance, as there could be account-specific configurations or limitations at play.
Sources
Working with shared resources in AWS End User Messaging SMS - AWS End User Messaging SMS
Share AWS End User Messaging SMS resources across multiple AWS accounts - AWS
SendTextMessage - AWS End User Messaging SMS
I was doing two things wrong:
- Wrong Java client. I should have used PinpointSmsVoiceV2Client (software.amazon.awssdk:pinpointsmsvoicev2)
- The resource policy in the source account (account owning the phone number) need to grant permissions to both the target account root as well as pinpoint service principle (pinpoint.amazonaws.com). Same can be done with RAM as well, but requires two resource shares as you can't add a different type of principal if a service principal is used in the resource share.
Relevant content
- asked 7 months ago
- asked 7 months ago
