Hello,
I did google this, and not sure if I am doing it right or maybe just missing one minor thing, I am just trying to verify if the file exists in S3, if so, great, if not, then... I will figure something out
for now I have the following code:
$DBList = Invoke-SQLQuery -Query $GetDBList.ToString() -QueryParameters $QueryParams
#Just a heads up, the $DBList just pulls 4 columns array:
#Databasename, Database backup file that i trim to get from Database Path, What environment, and ServerName
$s3Bucket = "S3"
ForEach ($DB in $DBList)
{
#Check which region will determin the bucket:
if($DB.Environment -eq 'Prod'){
$s3Bucket = 'S3-Prod'
}
elseif($DB.Environment -eq 'Test')
{
$s3Bucket = 'S3-Test'
}
else
{
$s3Bucket = "S3-BlackHole"
}
$s3Path = $DB.Environment + '/' + $DB.Servername + '/' + $DB.databasename + '/FULL'# + $DB.DBFileName
if(Get-S3Object -BucketName $s3Bucket -Key $s3Path | where{$_.Key -eq $DB.DBFileName}){
"File found " + $DB.DBFileName
}
else{
"File NOT found " + $DB.DBFileName
}
}
for some reason, I double check and I know for sure the files are there in the S3 bucket, in the specific directory, however when i run this PowerShell script above, it doesn't work, not sure what i am doing wrong? if anyone can assist in this, it would be awesome.
thanks in advance
February 18, 2021 at 12:10 am
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
got it working now,:
this helped below.
https://blog.revathskumar.com/2018/02/nodejs-list-s3-directories-with-aws-sdk.html
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy