How to do it…

Once you are logged in to your instance as the Admin domain user (this is the user you created when you were configuring the directory in step 3, not the machine administrator!), follow these steps to create and access an FSx file share:

  1. Open up a PowerShell terminal.
  2. Enter the following commands to enable script execution, import AWS Tools for Windows PowerShell, and then check the version to make sure everything works as expected:
PS C:UsersAdmin> Set-ExecutionPolicy RemoteSigned
PS C:UsersAdmin> Import-Module AWSPowerShell
PS C:UsersAdmin> Get-AWSPowerShellVersion

AWS Tools for Windows PowerShell
Version 3.3.462.0
Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Amazon Web Services SDK for .NET
Core Runtime Version 3.3.31.11
Copyright 2009-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Release notes: https://aws.amazon.com/releasenotes/PowerShell

This software includes third party software subject to the following copyrights:
- Logging from log4net, Apache License
[http://logging.apache.org/log4net/license.html]

  1. Set your access key and secret key:
PS C:UsersAdmin> Set-AWSCredential -AccessKey [YOUR-ACCESS-KEY] -SecretKey [YOUR-SECRET-KEY]
  1. Create the filesystem. After running this command, you will get an output that describes the filesystem. You can use ClientRequestToken to make queries relating to this specific filesystem as it is being created. Make sure you use the same subnet as your EC2 instance:
PS C:UsersAdmin> New-FSXFileSystem -ClientRequestToken MyToken -FileSystemType WINDOWS -StorageCapacity 300 -SubnetId YOUR_SUBNET_ID -WindowsConfiguration @{ThroughputCapacity=8;ActiveDirectoryId='YOUR_DIRECTORY_ID'}
  1. Check its progress. The following command returns information for all filesystems. It can take several minutes for the filesystem to become available, which is indicated by Lifecycle: AVAILABLE in the output:
PS C:UsersAdmin> Get-FSXFileSystem
  1. Once it's available, map the network drive via the file explorer, or use the following command:
PS C:UsersAdmin> net use E: \[YOUR-FILESYSTEM-ID].[YOUR-DOMAIN]share /persistent:yes
  1. Now, you should be able to read and write to the network share mapped to the E: drive. To test it, open notepad.exe and create a new file on the E: drive.
  2. To avoid further charges, terminate the instance, delete the filesystem, and remove Active Directory when you have finished this recipe.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset