Amazon SQS SenderId不一致 [英] Amazon SQS SenderId inconsitency

查看:80
本文介绍了Amazon SQS SenderId不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景如下:

  • 我有一个要写入多个AWS账户的Amazon SQS队列.
  • 我向特定的Amazon帐户ID列表授予写权限.
  • 每次从此队列中收到消息时,我也在询问"SenderId"属性.

这就是我可以确定哪些客户将作业放入队列中,从而知道向谁付款的方法.

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

我的问题是:

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

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

对于具有AWS账户ID 67890的客户B,SenderId为AFFFFCCUQBTZHXXMBGLTBK. 看起来完全是随机的...突如其来...

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

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

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.

问:在匿名访问的情况下,消息的"SenderId"属性值是什么? 当AWS账户ID不可用时(例如,匿名用户发送消息时),Amazon SQS提供IP地址.

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的内容

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

SenderId-返回发件人的AWS帐号(或IP地址,如果允许匿名访问).

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 .:我为什么要在意?如果我无法映射SenderId,则无法结算:(

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

推荐答案

好的,我在这里怀疑Amazon Identity Manager,我在此论坛

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

如果SQS消息的发送者使用了IAM凭据,则SenderId将是IAM用户ID,与"AWSAccessKeyID"不同

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"

如果SQS消息的发送者使用根" AWS凭证,则SenderId将是根帐号.

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

此信息是IAM提供的:

This information is what is provided by IAM:

对于root用户:

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

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

打印出一个数字,例如"123412341234"

prints out a number like "123412341234"

特定Iam用户的位置:

Whereas for a particular Iam user:

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

打印出"AIDADEADBEEF123"

prints out "AIDADEADBEEF123"

这篇关于Amazon SQS SenderId不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆