0

I'm writing a Python code to put files into S3 bucket. I'm connecting using key and Id.

I also need to work on something to get temporary key and id to connect and do the same.

I saw various options like assume_role, API calls etc. But, its pretty confusing for me.

My requirement - My python code (running on my machine) should generate temporary key and id to make a S3 connection (using boto).

Please help

  • 1
    you could also consider a presignedurl for s3 https://stackoverflow.com/questions/33549254/how-to-generate-url-from-boto3-in-amazon-web-services shows an example. – jeffrey Jun 12 '18 at 17:06
  • 1
    See a python example using boto to get temporary credentials here: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-api.html – Michael Conard Jun 12 '18 at 17:16
  • does your machine is an ec2 instance? then you can assign a role to the instance and aws-sdk will acquire temporary credentials by itself (using metadata services) – gusto2 Jun 12 '18 at 18:01
  • @MichaelConard I saw that page. It says - _The calls to AWS STS AssumeRole must be signed with the access key ID and secret access key of an existing IAM user ...._ . But that is not the case for me. I'm just running a Python script in my local machine – Subhrasish Mallik Jun 13 '18 at 07:39
  • @gusto2 I'm running the script in a local machine. Not an EC2 instance. – Subhrasish Mallik Jun 13 '18 at 07:40
  • `generate temporary key and id to make a S3 connect` at the end you need to authenticate and authorize somehow to get any access to non-public resources. So you could 'assume role' or create a pre-signed url. Assuming role can be done by other aws keys or cognito (by social network login). You cannot get any temporary access without having any access – gusto2 Jun 13 '18 at 08:55

0 Answers0