Access S3 using Role in python or command line tool

0

How to access s3 bucket using role in python or command line tool. I don't want to use Access Id and Secret Key combination in code.

4개 답변
0

Hi, @Amit Joshi

do you want to use it on your local machine?

Usually you need an access key and a secret.

Alternatively, you can make Assume Role by linking the identity provider.
https://aws.amazon.com/jp/premiumsupport/knowledge-center/aws-cli-call-store-saml-credentials/

For example, if you want to run Python or his commands on his EC2, you can use an EC2 instance profile, in which case you don't need an access key.

https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html

profile picture
전문가
iwasa
답변함 일 년 전
0

You don't need the Access Key Id and Secret Key in code, you can put them in environment variables or config files and they are used by both the CLI and boto3 in Python. See https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html for example.

전문가
답변함 일 년 전
0

If you are using CLI, you can create a profile to use IAM role. Refers to documentation at :

https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html

AWS
답변함 일 년 전
0

Some of this has been previously stated. You can use aws configure to put your access key and secret key in a file and python and aws cli will find it. If you use a standard location, it will just find it. You can update an environment variable to point to any location on your local computer if you'd like. Here's some documentation on setting this up. Hope this helps even though it's not about using a role. https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html

답변함 일 년 전

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

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

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

관련 콘텐츠