Update 12/5/2018: Pure Storage has modified the returned JSON file. The AccessKey is no longer stored as Id, rather it is stored as Name. I’ve updated the code below to reflect that.
Part of my job involves managing our storage fleet, both block storage and some file level services. I recently had a conversation with some developers about methods in which we were storing files. The current process involved multiple layers consisting of applications, servers, virtualization and storage systems. Not that great for a rapidly growing file system.
I suggested to the team that we investigate the use of our Pure Storage FlashBlade investment. The FlashBlade has native S3-compliant object store support, which would make it an ideal platform for what we were looking to do. To prove out that the FlashBlade could be up for the task, and to give some basic examples, I leveraged the AWS Tools for PowerShell to do some file manipulation on a bucket within our FlashBlade. If you’re looking to start doing some object storage on your FlashBlade check out the cmdlets here. Don’t forget to check out the FlashBlade REST API guide to see how you could write some native API integration and bypass the AWS tools entirely.
You will access the FlashBlade using an Access Key and a Secret Key. You’ll want to protect both of these. Note: These instructions were created prior to the introduction of Shared Accounts in Purity. I’ll update these once we have a FlashBlade on the newer Purity OS.
The AWS Tools can be obtained from the PowerShell Gallery:
Install-Module AWSPowerShell -confirm:$false
The AWS tools use a credential profile to store your access and secret key for use. They’re encrypted in your user profile on your system. Check out the AWS Tools for PowerShell documentation for more information.
$JSON = Get-Content -Raw -Path <Path to the JSON file created earlier> | ConvertFrom-JSON Set-AWSCredential -AccessKey $JSON.Name -SecretKey $JSON.secret_access_key -StoreAs default
# Create a new S3 Bucket New-S3Bucket -BucketName <name of the bucket> -EndpointUrl <FlashBlade URL> # List available buckets Get-S3Bucket -EndpointUrl <FlashBlade URL> # Delete a bucket Remove-S3Bucket -BucketName <name of the bucket> -EndpointUrl <flashblade URL>
#Store native content to an object $Content = @" <html> <head><title>PureStorage FlashBlade Object Storage</title></head> <body><h1>Welcome to PureStorage FlashBlade Object Storage</h1></body> </html> "@ Write-S3Object -BucketName <name of bucket to store object in> -Content $Content Key welcome.html -EndpointUrl <FlashBlade URL> # Upload an existing file to a bucket Write-S3Object -BucketName <name of bucket to store object in> -File <path to file> (optional: -key: key name for object in bucket) -EndpointUrl <FlashBlade URL> # Upload multiple files to a bucket Get-ChildItem <Path to files to upload> -File | Foreach-Object { Write-S3Object -BucketName <name of bucket to store object in> -File $_.FullName -Key $_.Name -EndpointUrl <FlashBlade URL> } # Upload contents of a folder to a bucket Write-S3Object -BucketName <name of bucket to store files in> -Folder <path to folder> -EndpointUrl <FlashBlade URL>
# List all objects in a bucket $BucketContents = Get-S3Object -BucketName <name of bucket to obtain list of objects from> -EndpointUrl <FlashBlade URL> $BucketContents | Format-Table $BucketContents | Out-GridView
# Removing a single known key object Remove-S3Object -BucketName <name of the bucket object exists in> -key <key of the object> -EndpointUrl <FlashBlade URL>
* The FlashArray now supports running containers/virtual machines via Purity Run. If you’re looking to provide NAS services off a FlashArray, check out the Windows File Server Run application for FlashArray.
After upgrading to UCS 4.1+ your UCS Fabric Interconnect may report "clean but with errors"…
Anyone that has spent any time with Cisco equipment should just come to expect that…
When Pure Storage released Purity 5.1 for the FlashArray they introduced a new host feature…
Note: This process should work for Windows and Linux as well. Verify the EFI boot…
We built our house a few years ago. Before all the drywall went up I…
It's almost VMworld time! Have you checked out the VMworld site yet and registered? VMworld…
This website uses cookies.