Home > database >  Connect to s3 using ARN role url using boto3 Python
Connect to s3 using ARN role url using boto3 Python

Time:02-17

I want to connect to the S3 using arn. but not sure how I can make a connection

I am looking for a code something like.

ARN = boto3.client('s3', 'arn:aws:iam::****:role/***')

Is there any way that I can make a connection using arn?

CodePudding user response:

it runs on ECS

If so, then you do not have to explicitly assume the role in your application. Instead you should use (its a good practice) an IAM Role for Task. Thus if you can change arn:aws:iam::****:role/*** into a task role, boto3 will automatically assume it and you don't have to do anything in your python code.

But if you still need to assume some role in your ECS task, then your IAM Role for Task should have sts:AsumeRole permission to actually be able to assume arn:aws:iam::****:role/***. But the first option is better choice if you can use it.

  • Related