Adrian Salazar
Adrian Salazar

Reputation: 5319

Amazon SQS SenderId inconsitency

The scenario is the following:

That's how I can identify which customer placed the Job in the queue, so I know who to bill.

My problem is:

For customer A with AWS account id 12345, the SenderId is 12345. It looks like an account ID.

For customer B with AWS account id 67890, the SenderId is AFFFFCCUQBTZHXXMBGLTBK. Which looks totally random... out of the blue...

There is nothing in the Amazon AWS documentation that tells that the sender ID can be other than the Amazon account ID. Well, except for anonymous access, which is not the case.

Q: What is the “SenderId” attribute value of a message in the case of anonymous access? Amazon SQS provides the IP address when the AWS account ID is not available such as when an anonymous user sends a message.

From the official API page this is what is said about the SenderId

SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender.

Any ideas about why this inconsistency?

P.S.: why do I care? If I can't map the SenderId I cannot bill :(

Upvotes: 3

Views: 3628

Answers (1)

Adrian Salazar
Adrian Salazar

Reputation: 5319

Okay people, I was suspecting about Amazon Identity Manager here, I've found the reason here in this forum https://forums.aws.amazon.com/thread.jspa?messageID=390680

If the sender of the SQS message used IAM credentials, then the SenderId will be the IAM user id, which is different than the "AWSAccessKeyID"

If the sender of the SQS message used the "root" AWS credentials, then the SenderId will be the root account number.

This information is what is provided by IAM:

for the root user:

AmazonIdentityManagement iam = new AmazonIdentityManagementClient(new BasicAWSCredentials(accessKey, secretKey));

GetUserResult getRootUserResult = iam.getUser();
System.out.println("RootUserId: "+ getRootUserResult.getUser().getUserId());

prints out a number like "123412341234"

Whereas for a particular Iam user:

GetUserRequest getUserRequest = new GetUserRequest().withUserName("sqsuser");
GetUserResult getUserResult = iam.getUser(getUserRequest);
System.out.println("UserId: "+ getUserResult.getUser().getUserId());

prints out "AIDADEADBEEF123"

Upvotes: 4

Related Questions