Skip to content

End user messaging Permission for lambda

0

I have given this permission for my lambda to send a message using end user messaging,

{ "Statement": [ { "Action": [ "sms-voice:SendTextMessage" ], "Effect": "Allow", "Resource": [ "arn:aws:sms-voice:eu-west-2:123456789:phone-number/", "arn:aws:sms-voice:eu-west-2:123456789:configuration-set/" ] } ], "Version": "2012-10-17" }

but i still get this error raise error_class(parsed_response, operation_name)\nbotocore.errorfactory.AccessDeniedException: An error occurred (AccessDeniedException) when calling the SendTextMessage operation: User: arn:aws:sts::123456789:assumed-role/dow-lambda-dev/j25-cc-connect-lambda-neo_sms_dow_change-dev is not authorized to perform: sms-voice:SendTextMessage because no identity-based policy allows the sms-voice:SendTextMessage action",

2 Answers
0

The error you're encountering indicates that your Lambda function doesn't have the proper permissions to execute the SendTextMessage operation, despite the policy you've attached.

There are a few things to check:

  1. Make sure the IAM role attached to your Lambda function includes the policy you've shared. The error suggests that the assumed role "dow-lambda-dev/j25-cc-connect-lambda-neo_sms_dow_change-dev" doesn't have the necessary permissions.

  2. Verify that the policy is correctly attached to the Lambda execution role, not just created but not associated.

  3. The policy prefix for AWS End User Messaging SMS actions is "sms-voice", which you've correctly used in your policy.

  4. Check that the resources in your policy match the actual resources you're trying to use. Your policy allows access to phone numbers and configuration sets in the eu-west-2 region for account 123456789.

  5. If you're using a specific origination identity (like a sender ID) rather than just a phone number, you might need to include that resource in your policy as well.

If you've verified all these points and are still experiencing issues, you might need to broaden the policy temporarily for testing (using "*" for the resource) to determine if there's another resource that needs permission.
Sources
SendTextMessage - AWS End User Messaging SMS
How AWS End User Messaging SMS works with IAM - AWS End User Messaging SMS
Working with shared resources in AWS End User Messaging SMS - AWS End User Messaging SMS

answered a year ago

0

I haven't tested it myself but I believe the Resource property is incorrect as it expects complete ARNs. You can use either the specific configuration set and phone number (see Resource types) or a wildcard. Something like:

"Resource": [
  "arn:aws:sms-voice:${Region}:${Account}:phone-number/*",
  "arn:aws:sms-voice:${Region}:${Account}:configuration-set/*"
]
AWS

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.