Amazon SQS 发件人 ID 不一致

Amazon SQS SenderId inconsitency

场景如下:

这就是我如何确定哪个客户将作业放入队列中,因此我知道向谁开账单。

我的问题是:

对于 AWS 账户 ID 为 12345 的客户 A,SenderId 为 12345。 它看起来像一个帐户 ID。

对于 AWS 账户 ID 为 67890 的客户 B,SenderId 为 AFFFFCCUQBTZHXXMBGLTBK。 看起来完全随机...出乎意料...

Amazon AWS 文档中没有任何内容表明发件人 ID 可以不是 Amazon 帐户 ID。好吧,除了匿名访问,情况并非如此。

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.

来自官方 API 页面,这是关于 SenderId 的说法

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

关于这种不一致的原因有什么想法吗?

P.S.: 我为什么要关心?如果我不能映射 SenderId,我就不能计费:(

好的朋友们,我在这里怀疑 Amazon Identity Manager,我在这个论坛找到了原因 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"