Skip to content

Automate PowerShell script for download files from S3

0

Hi, I want to create PowerShell script for automate download files from S3. The problem is with the credentials that I want to use to connect to AWS. I had been trying use "aws configure sso" but the problem is that I received this message "Error when retrieving token from sso: Token has expired and refresh failed". I has been looking for any solution on internet but I didn't see any that help me.

Regards!

2 Answers
0
  1. Install AWS Cli tool in windows, following this content.
  2. Authorize your command line tool into aws.
  3. Build your script. You are ready to go.

answered 3 years ago

  • Hi, thanks for answer. Just for have more context. Why if I "authorize my command line tool into aws" works for solving the error "Error when retrieving token from sso: Token has expired and refresh failed"?

0

You might want to check out this link https://docs.aws.amazon.com/prescriptive-guidance/latest/patterns/update-aws-cli-credentials-from-aws-iam-identity-center-by-using-powershell.html

You pretty much have to programmatically get a new token every time. Easiest way is to NOT use SSO but with a very limited access to grab those files with an API user using non-expiring access/secret key for this workload so you can automate this without worry.

Another way is to enable AWS S3 File Gateway so you can access the specific folder in S3 via SMB https://docs.aws.amazon.com/filegateway/latest/files3/smb-acl.html

AWS

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.