Account A
and Account B
.Account A
has a EKS cluster running with a flink cluster running on it. To manage the IAM roles, we use Kube2iam
.Pod-Role
Worker-Node-role
Account B
has a S3 bucket, which the Pod
hosted in Account A
worked node need to read.Possible Solution:
Account B
, let's say, AccountB_Bucket_access_role
with a policy that allows reading the bucket. Add Pod-Role
as a trusted entity to it.Pod-role
which allows switching to AccountB_Bucket_access_role
, basically the STS AssumeRole
action.custom_profile
, with role_arn
set to AccountB_Bucket_access_role
role's arn.AWS_PROFILE=AccountB_Bucket_access_role
.QUESTION: Given above whenever the flink app needs to talk to S3 bucket, it first assumes the AccountB_Bucket_access_role
role and is able to read the S3 bucket. But setting AWS_PROFILE
actually switches the role for flink app, hence all the POD-ROLE
permissions are lost, and they are required for proper functioning of flink app.
Is there a way, that this AWS custom_profile
could only be used when reading S3 bucket and it switches to POD-ROLE
after that.
val flinkEnv: StreamExecutionEnvironment = AppUtils.setUpAndGetFlinkEnvRef(config.flink)
val textInputFormat = new TextInputFormat(new Path(config.path))
env
.readFile(
textInputFormat,
config.path,
FileProcessingMode.PROCESS_CONTINUOUSLY,
config.refreshDurationMs
)
This is what I use in flink job to read S3 file.
Nvm, we can configure a role of one account to access a particular bucket from another account. Access Bucket from another account