AWS.Tools.S3 Get-S3Bucket Access Denied #282
-
Describe the bugHello Expected BehaviorGet Amazon.S3.Model.S3Bucket object from Get-S3Bucket Current BehaviorAccess Denied Reproduction Steps$Env:AWS_ACCESS_KEY_ID='qwe' Possible SolutionNo response Additional Information/ContextNo response AWS Tools for PowerShell version usedVersion 4.1.128 PowerShell version usedName Value PSVersion 7.2.5 Operating System and versionWindows 10 |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 3 replies
-
Note: I have "Access Denied" only when I run this script from my PC using keys. |
Beta Was this translation helpful? Give feedback.
-
@dburtsev You need to have the ListBuckets policy attached to your IAM user (having access keys and secret keys in above PowerShell snippet) in order to execute I'm unsure how
You may try using the Get-STSCallerIdentity CmdLet and AWS CLI aws sts get-caller-identity to see if there is any difference. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hello Ashish
685276224587 arn:aws:iam::685276224587:user/svc_mocsdw01AccessPA AIDAZ7DNFLRF5WRSTAXOC |
Beta Was this translation helpful? Give feedback.
-
@dburtsev Unfortunately I'm unable to reproduce the issue. I get Access Denied error while using both AWS CLI
In both the cases:
|
Beta Was this translation helpful? Give feedback.
-
We don't have any credentials in %USERPROFILE%.aws 08/02/2022 03:28 PM .08/02/2022 03:28 PM .. 08/02/2022 03:28 PM 31 config 1 File(s) 31 bytes 2 Dir(s) 25,655,758,848 bytes free %USERPROFILE%.aws>type config |
Beta Was this translation helpful? Give feedback.
-
@dburtsev I tested using both scenarios, including environment variable approach (as in your case) setting Thanks, |
Beta Was this translation helpful? Give feedback.
-
It works correctly. If you know the bucket name, you don't need ListBuckets permission. I expect that |
Beta Was this translation helpful? Give feedback.
-
If |
Beta Was this translation helpful? Give feedback.
-
AWS CLI is working. There is nothing to troubleshoot with AWS CLI team. S3 Browser and WinSCP also works. Boto3 python library works. |
Beta Was this translation helpful? Give feedback.
-
@dburtsev Looks like you are mixing 2 commands. Those two commands are not the same thing.
|
Beta Was this translation helpful? Give feedback.
-
Thanks, It works now. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
@dburtsev Looks like you are mixing 2 commands. Those two commands are not the same thing.
Get-S3Bucket
CmdLet is only listing buckets alias with a filter of one bucket. It is invoking ListBuckets service API operation.aws s3 ls 'bucket_name'
is listing objects in the bucket. It is invoking ListObjectsV2 service API operation (figured it out by using--debug
flag). The corresponding PowerShell CmdLet for listing bucket objects isGet-S3Object
, or betterGet-S3ObjectV2
.