- Newest
- Most votes
- Most comments
It appears that you're encountering a credential issue when trying to use the Write-S3Object cmdlet. Based on the steps you've provided, there are a few things we can check to resolve this issue:
-
When you set your AWS credentials using Set-AWSCredential, you're storing them with a profile name "myProfileName". However, when you're trying to use Write-S3Object, you're not specifying which profile to use.
-
To use the credentials you've stored, you need to either set them as the default credentials for your session or specify the profile name when using Write-S3Object.
Here are a couple of ways to resolve this:
Option 1: Set the stored credentials as default for your session: After setting your credentials with Set-AWSCredential, use: Set-AWSCredential -ProfileName myProfileName
Option 2: Specify the profile name when using Write-S3Object: Write-S3Object -BucketName "MyBucketName" -Key "gfi/2013 Jul - Sep.mdf" -File "F:\SQLDB\TO_AWS\2013 Jul - Sep.mdf" -ProfileName myProfileName
Either of these methods should allow the Write-S3Object cmdlet to use the credentials you've stored.
Also, ensure that the IAM user associated with these credentials has the necessary permissions to write objects to the specified S3 bucket. The user should have, at minimum, s3:PutObject permission for the bucket and objects within it.
If you're still encountering issues after trying these solutions, you may want to verify your credentials are correct and that they have the necessary permissions in AWS IAM.
Sources
Using AWS Credentials - AWS Tools for PowerShell
Amazon S3 examples using Tools for PowerShell - AWS SDK Code Examples
Awesome, thank you! It's tough piecing this altogether. I thought that's what the line Get-EC2Instance -ProfileName MyProfileName was doing.
File is uploading as I write this... thank you!
Relevant content
- asked 9 months ago