Amazon ECS タスク定義で FSx for Windows File Server ファイルシステムを指定する
コンテナに FSx for Windows File Server ファイルシステムボリュームを使用するには、タスク定義でボリュームとマウントポイントの設定を指定します。次のスニペットの JSON によるタスク定義では、コンテナの volumes と mountPoints オブジェクトの構文を示しています。
{ "containerDefinitions": [ { "entryPoint": [ "powershell", "-Command" ], "portMappings": [], "command": ["New-Item -Path C:\\fsx-windows-dir\\index.html -ItemType file -Value '<html> <head> <title>Amazon ECS Sample App</title> <style>body {margin-top: 40px; background-color: #333;} </style> </head><body> <div style=color:white;text-align:center> <h1>Amazon ECS Sample App</h1> <h2>It Works!</h2> <p>You are using Amazon FSx for Windows File Server file system for persistent container storage.</p>' -Force"], "cpu": 512, "memory": 256, "image": "mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019", "essential": false, "name": "container1", "mountPoints": [ { "sourceVolume": "fsx-windows-dir", "containerPath": "C:\\fsx-windows-dir", "readOnly": false } ] }, { "entryPoint": [ "powershell", "-Command" ], "portMappings": [ { "hostPort": 443, "protocol": "tcp", "containerPort": 80 } ], "command": ["Remove-Item -Recurse C:\\inetpub\\wwwroot\\* -Force; Start-Sleep -Seconds 120; Move-Item -Path C:\\fsx-windows-dir\\index.html -Destination C:\\inetpub\\wwwroot\\index.html -Force; C:\\ServiceMonitor.exe w3svc"], "mountPoints": [ { "sourceVolume": "fsx-windows-dir", "containerPath": "C:\\fsx-windows-dir", "readOnly": false } ], "cpu": 512, "memory": 256, "image": "mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019", "essential": true, "name": "container2" } ], "family": "fsx-windows", "executionRoleArn": "arn:aws:iam::111122223333:role/ecsTaskExecutionRole", "volumes": [ { "name": "fsx-windows-dir", "fsxWindowsFileServerVolumeConfiguration": { "fileSystemId": "fs-0eeb5730b2EXAMPLE", "authorizationConfig": { "domain": "example.com", "credentialsParameter": "arn:arn-1234" }, "rootDirectory": "share" } } ] }
FSxWindowsFileServerVolumeConfiguration-
タイプ: オブジェクト
必須: いいえ
このパラメータは、タスクストレージに FSx for Windows File Server ファイルシステムを使用する場合に指定します。
fileSystemId-
タイプ: 文字列
必須: はい
使用する FSx for Windows File Server ファイルシステムID。
rootDirectory-
タイプ: 文字列
必須: はい
ホスト内にルートディレクトリとしてマウントする FSx for Windows File Server ファイルシステム内のディレクトリ。
authorizationConfig-
credentialsParameter-
タイプ: 文字列
必須: はい
認可の認証情報オプション。
-
Secrets Manager シークレットの Amazon リソースネーム (ARN)。
-
用の Amazon リソースネーム (ARN)Systems Managerパラメータ。
-
domain-
タイプ: 文字列
必須: はい
AWS Directory Service for Microsoft Active Directory (AWS Managed Microsoft AD) ディレクトリ、またはセルフホスト型 EC2 Active Directory によってホストされる完全修飾ドメイン名。
FSx for Windows File Server ボリューム認証情報を保存する方法
credentials パラメータで使用するために認証情報を格納するには、2 つの異なる方法があります。
-
AWS Secrets Managerシークレット
この認証情報は、[その他のタイプのシークレット] カテゴリを使用して AWS Secrets Manager コンソールで作成できます。キー/値のペア、ユーザー名/管理者、パスワード/
パスワードごとに行を追加します。 -
Systems Manager パラメータ
この認証情報は、次のコードスニペット例でのフォームにテキストを入力することで、Systems Manager パラメータコンソールで作成できます。
{ "username": "admin", "password":"password"}
タスク定義の FSxWindowsFileServerVolumeConfiguration パラメータにある credentialsParameter では、シークレット ARN または Systems Manager パラメータ ARN が保持されます 。詳細については、Secrets Manager ユーザーガイド の「AWSSecrets Manager とは?」およびSecrets Manager ユーザーガイド の「Systems Manager パラメータの保存」を参照してください。