= Create new file shares
:toc:
:icons:
:linkattrs:
:imagesdir: ../resources/images


== Summary

This section will create new file shares.

You can use standard Microsoft tools to create new file shares on your Amazon FSx for Windows File Server.


== Duration

NOTE: It will take approximately 15 minutes to complete this section.


== Step-by-step Guide

=== Connect to Windows Instance 0

IMPORTANT: Read through all steps below and watch the quick video before continuing.

image::connect-windows-instance.gif[align="left", width=600]


. Open the link:https://console.aws.amazon.com/ec2/[Amazon EC2] console.
+
TIP: *_Context-click (right-click)_* the link above and open the link in a new tab or window to make it easy to navigate between this github tutorial and AWS console.

+
. Make sure you are in the same *AWS Region* as the tutorial environment.

. *_Select_* *Running Instances*.

. *_Select_* the radio button next to the instance with the name *Windows Instance 0*.

. Copy the *Public DNS (IPv4)* name of the *Windows Instance 0* instance.

. Launch your remote desktop application and create a new connection.

. Use the DNS name copied above as the host name of the new connection.

. Start a new remote desktop session to the new connection (you will retrieve the *user name* and *password* from *AWS Secrets Manager*).

. Open the link:https://console.aws.amazon.com/secretsmanager/[AWS Secrets Manager] console.
+
TIP: *_Context-click (right-click)_* the link above and open the link in a new tab or window to make it easy to navigate between this github workshop and AWS console.
+
. *_Select_* the *Secret name* link for *Password-<GUID>*.

. *_Scroll_* to the *Secret value* section and *_click_* the *Retrieve secret value* button.

. Use the *Secret key/value* pairs of *username* and *password* as the credentials to authenticate to the *Windows Instance 0* instance for the remote desktop session.

=== Map default file share

IMPORTANT: Read through all steps below and watch the quick video before continuing.

image::map-default-file-share.gif[align="left", width=600]


. Once you've logged on to the *Windows Instance 0* instance, *_launch_* *File Explorer*.

. *_Context-click (right-click)_* *This PC* and *_select_* *Map network drive...*

. Map the file share using the following information:
+
[cols="3,10"]
|===
| *Drive*
a| Z:

| *Folder*
a| This is the UNC path of the file system's default file share. From the link:https://console.aws.amazon.com/fsx/[Amazon FSx] console, *_click_* the link to the *STG326 - SAZ* file system and *_select_* the *Network & security* tab. *_Copy_* the *DNS Name* of the file system to the clipboard and paste it as the first part of the UNC path. *_Add_* *\share* to the end of the *DNS Name* to complete the UNC path to the file system's default file share (e.g. \\fs-0123456789abcdef.example.com\share).

| *Reconnect at sign-in*
a| Leave checked

| *Connect using different credentials*
a| Leave unchecked
|===
+
. In the *File Explorer* window of the *Z:* drive, create new test files. *_Context-click (right-click)_* >> *New* >> *Text Document*. Create a few different types of test files.

. Load sample data into the file system's default file share from the link:https://registry.opendata.aws/nasanex/[NASA NEX] project hosted on the registry of Open Data on AWS.

* Go to the remote desktop session for your *Windows Instance 0*.

* *_Click_* *Start* >> *Windows PowerShell*.

* *_Run_* the script in the *Windows PowerShell* window.
+
[source,bash]
----
Read-S3Object -BucketName nasanex -KeyPrefix /AVHRR -Folder Z:/nasanex/AVHRR

----
+

NOTE: It will take approximately 20 minutes to load this sample data. Continue with the next section while the data is loaded in the background.


=== Create new file shares

IMPORTANT: Read through all steps below and watch the quick video before continuing.

image::create-new-file-shares.gif[align="left", width=600]


. From the link:https://console.aws.amazon.com/fsx/[Amazon FSx] console, *_click_* the link to the *STG326 - SAZ* file system and *_select_* the *Network & security* tab. *_Copy_* the *DNS Name* of the file system to the clipboard.

. *_Click_* *Start*.

. *_Type_* *fsmgmt.msc*.

. From the *Shared Folders* Console, *_select_* *Action* >> *Connect to another computer...*.

. *_Paste_* the *DNS Name* copied above in the *Another computer:* text box and *_click_* *Ok*.

. *_Double-click_* the *Shares* folder.

. With the *Shares* folder selected, *_click_* *Action* >> *New Share...* from the menu.

. Complete the *Create A Shared Folder Wizard*, creating new shares with the following attributes:
+
|===
| *Folder path* | *Share name* | *Create new path* | *Shared folder permissions*
| D:\application
| application
| Yes
| Customize permissions >> Everyone Full Control

| D:\data
| data
| Yes
| Customize permissions >> Everyone Full Control
|===
+
. Experiment and create other file shares. All shares must be created on the *D:\* drive.

=== Manage file shares

IMPORTANT: Read through all steps below and watch the quick video before continuing.

image::manage-file-shares.gif[align="left", width=600]


. *_Copy_* the script below into your favorite text editor.
+
[source,bash]
----
$WindowsRemotePowerShellEndpoint = "windows_remote_powershell_endpoint" # e.g. "fs-0123456789abcdef.example.com"
enter-pssession -ComputerName ${WindowsRemotePowerShellEndpoint} -ConfigurationName FsxRemoteAdmin

----
+

. From the link:https://console.aws.amazon.com/fsx/[Amazon FSx] console, *_click_* the link to the *STG326 - SAZ* file system and *_select_* the *Network & security* tab. *_Copy_* the *Windows Remote PowerShell Endpoint* of the file system to the clipboard (e.g. fs-0123456789abcdef.example.com).

. Return to your favorite text editor and replace *"windows_remote_powershell_endpoint"* with the *Windows Remote PowerShell Endpoint* of *STG326 - SAZ*. *_Copy_* the updated script.

. Go to the remote desktop session for your *Windows Instance 0*.

. *_Click_* *Start* >> *Windows PowerShell*.

. *_Run_* the updated script in the *Windows PowerShell* window.

. Complete the next few steps using the remote PowerShell session to the FSx file server.

. Review the PowerShell function commands available using the *Amazon FSx CLI for remote management on PowerShell*.

* *_Run_* the command in the *Remote Windows PowerShell Session*.
+
[source,bash]
----
Get-Command
----
+

. What commands are available?

. Review all the different commands available using the *Amazon FSx CLI for remote management on PowerShell*.

. Examine your file system using the commands in the table below.

* *_Run_* the commands in the remote PowerShell session.
+
|===
| *Command*
| Get-FSxSmbShare

| Get-FSxSmbSession

| Get-FSxSmbServerConfiguration

| Get-FSxSmbShareAccess (when prompted, enter these share names: application, data, share)
|===
+
. End the remote PowerShell session. *_Run_* *Exit-PSSession*.

. Close the PowerShell window. *_Run_* *exit*.

. Close the Shared Folders Console.

== Next section

Click the button below to go to the next section.

image::04-test-performance.png[link=../04-test-performance/, align="left",width=420]




