Skip to content

Instantly share code, notes, and snippets.

@j3tm0t0
Created March 8, 2012 11:53
Show Gist options
  • Save j3tm0t0/2000684 to your computer and use it in GitHub Desktop.
Save j3tm0t0/2000684 to your computer and use it in GitHub Desktop.
S3 Client .NET
Add-Type -Path "C:\Program Files\AWS SDK for .NET\bin\AWSSDK.dll"
$secretKeyID="secretkeyid"
$secretAccessKeyID="accesskeyid"
$client=[Amazon.AWSClientFactory]::CreateAmazonS3Client($secretAccessKeyID,$secretKeyID)
$backup_directory="C:\target\"
foreach($file in Get-ChildItem -Path $backup_directory){
$request = New-Object -TypeName Amazon.S3.Model.PutObjectRequest
[void]$request.WithFilePath($file.fullname)
[void]$request.WithBucketName("bucketname")
[void]$request.WithKey($file.name)
[void]$request.WithTimeout(3600000)
[void]$client.PutObject($request)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment