[Amazon FSx for NetApp ONTAP] ファイルシステムのENIをデタッチしてみた

FSx for ONTAPファイルシステムのENIは絶対デタッチしてはいけない
2023.03.08

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

ENIをデタッチした時の挙動が気になる

こんにちは、のんピ(@non____97)です。

皆さんはAmazon FSx for NetApp ONTAP(以降FSx for ONTAP)のファイルシステムのENIをデタッチしてみたしたいなと思ったことはありますか? 私はあります。

FSx for ONTAPファイルシステムのENIの説明を見ると[Do not detach or untag] Amazon FSx network interface for ファイルシステムIDとENIのデタッチとタグを外すことはするなと記載されています。

Do not detach or untag

するなと言われたらやりたくなりますよね?

実際に試してみたので紹介します。

いきなりまとめ

  • FSx for ONTAPファイルシステムのENIは絶対にデタッチしてはいけない
    • デタッチするとファイルシステムに接続できなくなる
    • ファイルシステムのステータスもFAILEDとなる
  • ENIを再アタッチすることはできない
  • FSx for ONTAPファイルシステムのステータスもFAILEDとなり、新しいファイルシステムを作ることを促される

やってみた

管理エンドポイントのIPアドレスが紐づいていないENIのデタッチ

実際にやってみます。

いきなり管理エンドポイントのIPアドレスが紐づいているENIをデタッチしてしまうと何もできなくなる予感がしたので、スタンバイ側のENIをデタッチします。

FSx for ONTAPファイルシステムのENI一覧を確認します。

$ aws ec2 describe-network-interfaces \
    --network-interface-ids eni-09fe1981b2cff1a9a eni-046d4ab2947f8eafb
{
    "NetworkInterfaces": [
        {
            "Attachment": {
                "AttachTime": "2023-03-06T08:56:42+00:00",
                "AttachmentId": "eni-attach-0663f03c69824bc19",
                "DeleteOnTermination": false,
                "DeviceIndex": 3,
                "NetworkCardIndex": 0,
                "InstanceOwnerId": "982776934170",
                "Status": "attached"
            },
            "AvailabilityZone": "us-east-1a",
            "Description": "[Do not detach or untag] Amazon FSx network interface for fs-0076fbbfe3f267f62",
            "Groups": [
                {
                    "GroupName": "non-97-fsxn-sg",
                    "GroupId": "sg-0fb47d7ad6e53f393"
                }
            ],
            "InterfaceType": "interface",
            "Ipv6Addresses": [],
            "MacAddress": "0a:90:66:6e:41:d9",
            "NetworkInterfaceId": "eni-046d4ab2947f8eafb",
            "OwnerId": "<AWSアカウントID>",
            "PrivateDnsName": "ip-10-0-8-214.ec2.internal",
            "PrivateIpAddress": "10.0.8.214",
            "PrivateIpAddresses": [
                {
                    "Primary": true,
                    "PrivateDnsName": "ip-10-0-8-214.ec2.internal",
                    "PrivateIpAddress": "10.0.8.214"
                },
                {
                    "Primary": false,
                    "PrivateDnsName": "ip-10-0-8-121.ec2.internal",
                    "PrivateIpAddress": "10.0.8.121"
                },
                {
                    "Primary": false,
                    "PrivateDnsName": "ip-10-0-8-91.ec2.internal",
                    "PrivateIpAddress": "10.0.8.91"
                },
                {
                    "Primary": false,
                    "PrivateDnsName": "ip-10-0-8-55.ec2.internal",
                    "PrivateIpAddress": "10.0.8.55"
                }
            ],
            "RequesterId": "470192892696",
            "RequesterManaged": false,
            "SourceDestCheck": true,
            "Status": "in-use",
            "SubnetId": "subnet-0ddc1cafa116ba0dd",
            "TagSet": [
                {
                    "Key": "AmazonFSx.FileSystemId",
                    "Value": "fs-0076fbbfe3f267f62"
                }
            ],
            "VpcId": "vpc-043c0858ea33e8ec2"
        },
        {
            "Attachment": {
                "AttachTime": "2023-03-06T08:56:43+00:00",
                "AttachmentId": "eni-attach-055e01e09f2388654",
                "DeleteOnTermination": false,
                "DeviceIndex": 3,
                "NetworkCardIndex": 0,
                "InstanceOwnerId": "982776934170",
                "Status": "attached"
            },
            "AvailabilityZone": "us-east-1a",
            "Description": "[Do not detach or untag] Amazon FSx network interface for fs-0076fbbfe3f267f62",
            "Groups": [
                {
                    "GroupName": "non-97-fsxn-sg",
                    "GroupId": "sg-0fb47d7ad6e53f393"
                }
            ],
            "InterfaceType": "interface",
            "Ipv6Addresses": [],
            "MacAddress": "0a:e9:a0:aa:b0:b3",
            "NetworkInterfaceId": "eni-09fe1981b2cff1a9a",
            "OwnerId": "<AWSアカウントID>",
            "PrivateDnsName": "ip-10-0-8-213.ec2.internal",
            "PrivateIpAddress": "10.0.8.213",
            "PrivateIpAddresses": [
                {
                    "Primary": true,
                    "PrivateDnsName": "ip-10-0-8-213.ec2.internal",
                    "PrivateIpAddress": "10.0.8.213"
                },
                {
                    "Primary": false,
                    "PrivateDnsName": "ip-10-0-8-92.ec2.internal",
                    "PrivateIpAddress": "10.0.8.92"
                }
            ],
            "RequesterId": "470192892696",
            "RequesterManaged": false,
            "SourceDestCheck": true,
            "Status": "in-use",
            "SubnetId": "subnet-0ddc1cafa116ba0dd",
            "TagSet": [
                {
                    "Key": "AmazonFSx.FileSystemId",
                    "Value": "fs-0076fbbfe3f267f62"
                }
            ],
            "VpcId": "vpc-043c0858ea33e8ec2"
        }
    ]
}

管理エンドポイントのIPアドレスはeni-attach-0663f03c69824bc19に紐づいているようです。そのため、eni-attach-055e01e09f2388654をデタッチしてみます。

ONTAP CLIからLIFの状態も確認します。

::> network interface show
            Logical    Status     Network            Current       Current Is
Vserver     Interface  Admin/Oper Address/Mask       Node          Port    Home
----------- ---------- ---------- ------------------ ------------- ------- ----
FsxId0076fbbfe3f267f62
            fsxadmin     up/up    10.0.8.121/24      FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
            inter_1      up/up    10.0.8.214/24      FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
            inter_2      up/up    10.0.8.213/24      FsxId0076fbbfe3f267f62-02
                                                                   e0e     true
svm
            iscsi_1      up/up    10.0.8.55/24       FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
            iscsi_2      up/up    10.0.8.92/24       FsxId0076fbbfe3f267f62-02
                                                                   e0e     true
            nfs_smb_management_1
                         up/up    10.0.8.91/24       FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
6 entries were displayed.

いずれのLIFもupで、fsxadminnfs_smb_management_1というLIFはFsxId0076fbbfe3f267f62-01というノードに動いていますね。

NFSでFSx for ONTAPファイルシステム上のボリュームをマウントしておきます。

$ sudo mount -t nfs svm-09b9d1dc93bd7c5fc.fs-0076fbbfe3f267f62.fsx.us-east-1.amazonaws.com:/vol1 /mnt/fsxn/vol1

$ df -hT -t nfs4
Filesystem                                                                   Type  Size  Used Avail Use% Mounted on
svm-09b9d1dc93bd7c5fc.fs-0076fbbfe3f267f62.fsx.us-east-1.amazonaws.com:/vol1 nfs4  973M  320K  973M   1% /mnt/fsxn/vol1

それではeni-attach-055e01e09f2388654をデタッチします。

管理エンドポイントのIPが付与されていないENIのデタッチ

デタッチして5分ほど待ちましたが、ステータスはdetachingのままでした。

$ aws ec2 describe-network-interfaces \
    --network-interface-ids eni-09fe1981b2cff1a9a
{
    "NetworkInterfaces": [
        {
            "Attachment": {
                "AttachTime": "2023-03-06T08:56:43+00:00",
                "AttachmentId": "eni-attach-055e01e09f2388654",
                "DeleteOnTermination": false,
                "DeviceIndex": 3,
                "NetworkCardIndex": 0,
                "InstanceOwnerId": "982776934170",
                "Status": "detaching"
            },
            "AvailabilityZone": "us-east-1a",
            "Description": "[Do not detach or untag] Amazon FSx network interface for fs-0076fbbfe3f267f62",
            "Groups": [
                {
                    "GroupName": "non-97-fsxn-sg",
                    "GroupId": "sg-0fb47d7ad6e53f393"
                }
            ],
            "InterfaceType": "interface",
            "Ipv6Addresses": [],
            "MacAddress": "0a:e9:a0:aa:b0:b3",
            "NetworkInterfaceId": "eni-09fe1981b2cff1a9a",
            "OwnerId": "<AWSアカウントID>",
            "PrivateDnsName": "ip-10-0-8-213.ec2.internal",
            "PrivateIpAddress": "10.0.8.213",
            "PrivateIpAddresses": [
                {
                    "Primary": true,
                    "PrivateDnsName": "ip-10-0-8-213.ec2.internal",
                    "PrivateIpAddress": "10.0.8.213"
                },
                {
                    "Primary": false,
                    "PrivateDnsName": "ip-10-0-8-92.ec2.internal",
                    "PrivateIpAddress": "10.0.8.92"
                }
            ],
            "RequesterId": "470192892696",
            "RequesterManaged": false,
            "SourceDestCheck": true,
            "Status": "in-use",
            "SubnetId": "subnet-0ddc1cafa116ba0dd",
            "TagSet": [
                {
                    "Key": "AmazonFSx.FileSystemId",
                    "Value": "fs-0076fbbfe3f267f62"
                }
            ],
            "VpcId": "vpc-043c0858ea33e8ec2"
        }
    ]
}

LIFを確認するとFsxId0076fbbfe3f267f62-02のLIFであるinter_2iscsi_2が落ちていました。

::> network interface show            Logical    Status     Network            Current       Current Is
Vserver     Interface  Admin/Oper Address/Mask       Node          Port    Home
----------- ---------- ---------- ------------------ ------------- ------- ----
FsxId0076fbbfe3f267f62
            fsxadmin     up/up    10.0.8.121/24      FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
            inter_1      up/up    10.0.8.214/24      FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
            inter_2      up/-     10.0.8.213/24      FsxId0076fbbfe3f267f62-02
                                                                   e0e     true
svm
            iscsi_1      up/up    10.0.8.55/24       FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
            iscsi_2      up/-     10.0.8.92/24       FsxId0076fbbfe3f267f62-02
                                                                   e0e     true
            nfs_smb_management_1
                         up/up    10.0.8.91/24       FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
6 entries were displayed.

管理アクティビティの監査ログには特にイベントを記録されていませんでした。

::> security audit log show -fields timestamp, node, application, location, vserver, username, input, state, message -state Error|Success -timestamp >"Mon Mar 06 10:00:00 2023"
timestamp                  node                      application location   vserver                username input      state   message
-------------------------- ------------------------- ----------- ---------- ---------------------- -------- ---------- ------- -------
"Mon Mar 06 10:00:59 2023" FsxId0076fbbfe3f267f62-01 ssh         10.0.0.207 FsxId0076fbbfe3f267f62 fsxadmin Logging in Success -
"Mon Mar 06 10:01:09 2023" FsxId0076fbbfe3f267f62-01 ssh         10.0.0.207 FsxId0076fbbfe3f267f62 fsxadmin statistics lif show
                                                                                                                       Success -
2 entries were displayed.

NFSによる接続も継続してできていました。

$ df -hT -t nfs4
Filesystem                                                                   Type  Size  Used Avail Use% Mounted on
svm-09b9d1dc93bd7c5fc.fs-0076fbbfe3f267f62.fsx.us-east-1.amazonaws.com:/vol1 nfs4  973M  320K  973M   1% /mnt/fsxn/vol1

$ ls -l /mnt/fsxn/vol1/
total 0

# テストファイルの作成
$ sudo touch /mnt/fsxn/vol1/test

$ ls -l /mnt/fsxn/vol1/
total 0
-rw-r--r-- 1 root root 0 Mar  6 10:11 test

ふと、FSx for ONTAPファイルシステムを確認すると、The elastic network interface (ENI) created by Amazon FSx for your file system no longer exists or is no longer attached to the file system. Please delete your file system and create a new file system.とENIがアタッチされていないので、ファイルシステムを削除して、新しいファイルシステムを作成してくれとメッセージが出力されていました。

The elastic network interface (ENI) created by Amazon FSx for your file system no longer exists or is no longer attached to the file system

やはり、ENIはデタッチしてはならないということですね。

AWS CLIからもこちらのメッセージは確認できます。

$ aws fsx describe-file-systems --file-system-ids fs-0076fbbfe3f267f62
{
    "FileSystems": [
        {
            "OwnerId": "<AWSアカウントID>",
            "CreationTime": "2023-03-06T09:12:33.914000+00:00",
            "FileSystemId": "fs-0076fbbfe3f267f62",
            "FileSystemType": "ONTAP",
            "Lifecycle": "FAILED",
            "FailureDetails": {
                "Message": "The elastic network interface (ENI) created by Amazon FSx for your file system no longer exists or is no longer attached to the file system. Please delete your file system and create a new file system."
            },
            "StorageCapacity": 1024,
            "StorageType": "SSD",
            "VpcId": "vpc-043c0858ea33e8ec2",
            "SubnetIds": [
                "subnet-0ddc1cafa116ba0dd"
            ],
            "NetworkInterfaceIds": [
                "eni-046d4ab2947f8eafb",
                "eni-09fe1981b2cff1a9a"
            ],
            "KmsKeyId": "arn:aws:kms:us-east-1:<AWSアカウントID>:key/73e96c0a-aeb6-4813-aae6-1882c899d445",
            "ResourceARN": "arn:aws:fsx:us-east-1:<AWSアカウントID>:file-system/fs-0076fbbfe3f267f62",
            "Tags": [
                {
                    "Key": "Name",
                    "Value": "test-fsxn"
                }
            ],
            "OntapConfiguration": {
                "AutomaticBackupRetentionDays": 7,
                "DailyAutomaticBackupStartTime": "03:00",
                "DeploymentType": "SINGLE_AZ_1",
                "Endpoints": {
                    "Intercluster": {
                        "DNSName": "intercluster.fs-0076fbbfe3f267f62.fsx.us-east-1.amazonaws.com",
                        "IpAddresses": [
                            "10.0.8.214",
                            "10.0.8.213"
                        ]
                    },
                    "Management": {
                        "DNSName": "management.fs-0076fbbfe3f267f62.fsx.us-east-1.amazonaws.com",
                        "IpAddresses": [
                            "10.0.8.121"
                        ]
                    }
                },
                "DiskIopsConfiguration": {
                    "Mode": "AUTOMATIC",
                    "Iops": 3072
                },
                "PreferredSubnetId": "subnet-0ddc1cafa116ba0dd",
                "ThroughputCapacity": 128,
                "WeeklyMaintenanceStartTime": "5:06:00"
            }
        }
    ]
}

なかなかENIのステータスが変わらないので、強制的にENIをデタッチしてみます。

管理エンドポイントのIPが付与されていないENIの強制デタッチ

すると、ENIのステータスがavailableに変わりました。

$ aws ec2 describe-network-interfaces \
    --network-interface-ids eni-09fe1981b2cff1a9a
{
    "NetworkInterfaces": [
        {
            "AvailabilityZone": "us-east-1a",
            "Description": "[Do not detach or untag] Amazon FSx network interface for fs-0076fbbfe3f267f62",
            "Groups": [
                {
                    "GroupName": "non-97-fsxn-sg",
                    "GroupId": "sg-0fb47d7ad6e53f393"
                }
            ],
            "InterfaceType": "interface",
            "Ipv6Addresses": [],
            "MacAddress": "0a:e9:a0:aa:b0:b3",
            "NetworkInterfaceId": "eni-09fe1981b2cff1a9a",
            "OwnerId": "<AWSアカウントID>",
            "PrivateDnsName": "ip-10-0-8-213.ec2.internal",
            "PrivateIpAddress": "10.0.8.213",
            "PrivateIpAddresses": [
                {
                    "Primary": true,
                    "PrivateDnsName": "ip-10-0-8-213.ec2.internal",
                    "PrivateIpAddress": "10.0.8.213"
                },
                {
                    "Primary": false,
                    "PrivateDnsName": "ip-10-0-8-92.ec2.internal",
                    "PrivateIpAddress": "10.0.8.92"
                }
            ],
            "RequesterId": "470192892696",
            "RequesterManaged": false,
            "SourceDestCheck": true,
            "Status": "available",
            "SubnetId": "subnet-0ddc1cafa116ba0dd",
            "TagSet": [
                {
                    "Key": "AmazonFSx.FileSystemId",
                    "Value": "fs-0076fbbfe3f267f62"
                }
            ],
            "VpcId": "vpc-043c0858ea33e8ec2"
        }
    ]
}

LIF、管理アクティビティの監査ログどちらも変わりはありません。

# LIFの確認
::> network interface show
            Logical    Status     Network            Current       Current Is
Vserver     Interface  Admin/Oper Address/Mask       Node          Port    Home
----------- ---------- ---------- ------------------ ------------- ------- ----
FsxId0076fbbfe3f267f62
            fsxadmin     up/up    10.0.8.121/24      FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
            inter_1      up/up    10.0.8.214/24      FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
            inter_2      up/-     10.0.8.213/24      FsxId0076fbbfe3f267f62-02
                                                                   e0e     true
svm
            iscsi_1      up/up    10.0.8.55/24       FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
            iscsi_2      up/-     10.0.8.92/24       FsxId0076fbbfe3f267f62-02
                                                                   e0e     true
            nfs_smb_management_1
                         up/up    10.0.8.91/24       FsxId0076fbbfe3f267f62-01
                                                                   e0e     true
6 entries were displayed.

# 管理アクティビティの監査ログの確認
::> security audit log show -fields timestamp, node, application, location, vserver, username, input, state, message -state Error|Success -timestamp >"Mon Mar 06 10:00:00 2023"
timestamp                  node                      application location   vserver                username input      state   message
-------------------------- ------------------------- ----------- ---------- ---------------------- -------- ---------- ------- -------
"Mon Mar 06 10:00:59 2023" FsxId0076fbbfe3f267f62-01 ssh         10.0.0.207 FsxId0076fbbfe3f267f62 fsxadmin Logging in Success -
"Mon Mar 06 10:01:09 2023" FsxId0076fbbfe3f267f62-01 ssh         10.0.0.207 FsxId0076fbbfe3f267f62 fsxadmin statistics lif show
                                                                                                                       Success -
2 entries were displayed.

また、NFSで継続してボリュームにアクセスできています。

$ df -hT -t nfs4
Filesystem                                                                   Type  Size  Used Avail Use% Mounted on
svm-09b9d1dc93bd7c5fc.fs-0076fbbfe3f267f62.fsx.us-east-1.amazonaws.com:/vol1 nfs4  973M  320K  973M   1% /mnt/fsxn/vol1

$ ls -l /mnt/fsxn/vol1/
total 0
-rw-r--r-- 1 root root 0 Mar  6 10:11 test

管理エンドポイントのIPアドレスが紐づいているENIのデタッチ

続いて、管理エンドポイントのIPアドレスが紐づいているENIのデタッチします。

管理エンドポイントのIPが付与されているENIの強制デタッチ

デタッチすると、FSx for ONTAPファイルシステムに接続していたSSHが切れました。再接続しようとしても接続できません。

$ ssh fsxadmin@management.fs-0076fbbfe3f267f62.fsx.us-east-1.amazonaws.com -v
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to management.fs-0076fbbfe3f267f62.fsx.us-east-1.amazonaws.com [10.0.8.121] port 22.

また、ls -l /mnt/fsxn/vol1/でNFSでマウントしたボリュームにもアクセスできなくなりました。

ENIのアタッチ

それではデタッチしてしまったENIを再度アタッチしようとしてみます。

ENIのアタッチする画面を開くとEC2インスタンスを選択するプルダウンメニューが表示されました。

ENIのアタッチ

ENIをアタッチするAPIであるAttachNetworkInterfaceを確認すると、確かにインスタンスIDが必須項目でした。

InstanceId

The ID of the instance. Type: String Required: Yes

AttachNetworkInterface - Amazon Elastic Compute Cloud

ということでデタッチしてしまうENIをFSx for ONTAPファイルシステムに再度アタッチし直すことはできなさそうです。

FSx for ONTAPファイルシステムのENIは絶対デタッチしてはいけない

Amazon FSx for NetApp ONTAPファァイルシステムのENIをデタッチしてみました。

ENIの説明に強調して書かれていますが、デタッチしようと思えばできてしまうのが怖いところですね。

面白半分でENIをデタッチしないようにしましょう。

なお、ENIをデタッチしている状態でFSx for ONTAPファイルシステムを削除すると、一緒にENIも削除されていました。

この記事が誰かの助けになれば幸いです。

以上、AWS事業本部 コンサルティング部の のんピ(@non____97)でした!