This is going to be a short tutorial on how to use two tools, PowerShell and Amazon AWS S3, to easily create and update files in the cloud. This can be used to maintain a repository of files that you may need to access from multiple systems, an online archive, or as a cloud backup mechanism which you can run automatically with Task Scheduler.
The advantage of using S3 as opposed to something like Dropbox is that S3 is a cloud storage solution, so you can push files to it without having it sync an entire folder. While it's not free, it's also a lot cheaper than many professional backup solutions out there, and can work fine for small to medium deployments.
Import-Module AWSPowerShell
in a normal PS window.Set-AWSCredentials
cmdlet.From here, you can use the various command line tools to upload files:
<powershell>
Write-S3Object -BucketName mybucket -Key path/to/file.ext -File C:\file.ext
Or even a whole folder:
<powershell>
Write-S3Object -BucketName mybucket -KeyPrefix path/to/ -Folder C:\temp
You can get a list of items stored in your bucket with:
<powershell>
Get-S3Object -BucketName mybucket
Finally, get the file back with:
<powershell>
Read-S3Object -BucketName mybucket -Key path/to/file.ext -File C:\newfile.ext
The advantage of using S3 and PowerShell is how you can create scripts to automatically accomplish tasks, such as daily backups. If you want to use these commands as part of a script, you're going to have to manage authentication yourself. You can do it with this command:
<powershell>
Set-AWSCredentials -AccessKey mykey -SecretKey mysecret -StoreAs s3profile
Then, add the -ProfileName s3profile
argument to any command we've seen above.
S3 also has advanced features you can use such as encryption and versioning, to keep track of file changes. There are also many tools out there to work with S3 storage, such as S3 Browser for Windows which gives you an Explorer style interface, Linux tools and even mobile apps.
One thing to keep in mind is that S3 isn't free, so make sure you review your bill before uploading your whole library! Also note that the AWS PowerShell tools work for other services like EC2 and SNS as well. Feel free to explore them in the official documentation.