command to SSH Linux database server:
ssh rajeevrajendran@172.31.80.168 -i users_rajeevrajendran_rsa
Command to connect Linux database server
mongo -–port 37017 -u admindba admin -p
command to SSH Linux database server:
ssh rajeevrajendran@172.31.80.168 -i users_rajeevrajendran_rsa
Command to connect Linux database server
mongo -–port 37017 -u admindba admin -p
$accessKey = '***********************'
$secretKey = '****************************'
$region = 'us-west-2'
$bucket = 'databasemssqlprod'
$keyPrefix = '/awstssqlp01/AWSTSSQLP01_DocumentManagement_FULL.bak'
$localPath = 'B:\backup'
$objects = Get-S3Object -BucketName $bucket -KeyPrefix $keyPrefix -AccessKey $accessKey -SecretKey $secretKey -Region $region | Sort-Object LastModified -descending | Select-Object -First 2 | select key
foreach($object in $objects) {
$localFileName = $object.Key -replace $keyPrefix, ''
if ($localFileName -ne '') {
$localFilePath = Join-Path $localPath $localFileName
Copy-S3Object -BucketName $bucket -Key $object.Key -LocalFile $localFilePath -AccessKey $accessKey -SecretKey $secretKey -Region $region
}
}
remove-item -path B:\backup\*.bak