Sunday, February 6, 2022

[AWS] Update or create a DNS CNAME record for the file system

 I am trying to access the filesystem I implemented in Amazon FSx for Windows Server by creating and configuring the DNS alias since the default filesystem DNS name given by Amazon does not speak much. Therefore, it is an alternative good way if we do not want to configure that using the DFS namespace.

Below are the steps to create a DNS CNAME record:

Note this is Step 2 after creating/update the SPN.

1. Open PowerShell as administrator on the server with a priviliged accounts which has DNS administration permissions.

2. Run the below command :

Install-WindowsFeature RSAT-DNS-Server

 

3. To update or create a custom DNS name to the Amazon FSx file system, use the below command by replacing the dns alias and filesystem dns name :

 $Alias="alias_fqdn"$FSxDnsName="file_system_dns_name"$AliasHost=$Alias.Split('.')[0]$ZoneName=((Get-WmiObject Win32_ComputerSystem).Domain)$DnsServerComputerName = (Resolve-DnsName $ZoneName -Type NS | Where Type -eq 'A' | Select -ExpandProperty Name)[0]Add-DnsServerResourceRecordCName -Name $AliasHost -ComputerName $DnsServerComputerName -HostNameAlias $FSxDnsName -ZoneName $ZoneName

 

 

 You have now added a DNS CNAME value for your Amazon FSx file system with the DNS alias. You can now use the DNS alias to access your data.

Result: