How to put records into a kinesis stream in another AWS account?

0

Is it possible to put records into a kinesis stream located in another AWS account?

I configured my kinesis producer with an STS assumed role, but I can't see how to specify a stream name in another account (it doesn't accept an ARN, only a stream name).

Init logic:

            AWSCredentialsProviderChain credentialsProvider = new AWSCredentialsProviderChain(
                    DefaultAWSCredentialsProviderChain.getInstance(),
                    new STSAssumeRoleSessionCredentialsProvider.Builder(
                            config.getKinesisStreamRoleArn(),
                            roleSessionName)
                                    .withExternalId(config.getKinesisStreamRoleExternalId())
                                    .build());

            Properties props = new Properties();
            props.load(getClass().getClassLoader().getResourceAsStream("kinesis_producer_config.properties"));
            KinesisProducerConfiguration producerConfig = KinesisProducerConfiguration.fromProperties(props)
                    .setCredentialsProvider(credentialsProvider);

            if (!Strings.isNullOrEmpty(config.getKinesisStreamRegion())) {
                producerConfig.setRegion(config.getKinesisStreamRegion());
            }

            return new KinesisProducer(producerConfig);

and the error:

Encountered AWSError
ResourceNotFoundException
Stream my-stream under account 111111111111 not found.:

(where 111111111111 is the other aws account)

질문됨 5년 전2040회 조회
1개 답변
0

Figured it out; I was creating a AWSCredentialsProviderChain, and including the DefaultAWSCredentialsProviderChain first in the constructor. When I changed the order to include the STSAssumeRoleSessionCredentialsProvider first, it was then able to find the stream in the other AWS account successfully.

답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠