AWS Fargate 向け Attribute センサー
このドキュメントでは、AWS Fargate のタスク定義に Attribute センサーをインストールするために必要な情報と設定について説明します。
背景
Attribute は、アプリケーションレベルの新たなランタイムデータのレイヤーを可視化し、それをクラウドおよび SaaS プラットフォームコストに直接紐付ける FinOps プラットフォームです。タスクレベルのコストを分析し、S3・RDS・ElastiCache などのリソースにアトリビュートできる、独自の初の AWS Fargate センサーを開発しました。
以下の手順を確認し、ご不明点がありましたら弊社チームまでお問い合わせください。
ステップ 1: containerDefinitions を更新
タスク定義内で、該当する containerDefinition を次のように修正します。
environment セクションに環境変数を追加します:
"environment": [
{
"name": "CONFIG_ZPROBE_BEARER_TOKEN",
"value": "<token>"
},
{
"name": "CONFIG_ZPROBE_OTEL_ADDR",
"value": "otel-endpoint.app.attrb.io:443"
}
]
dependsOn セクションに依存関係を追加します:
"dependsOn": [
{
"containerName": "attribute-sensor-loader",
"condition": "COMPLETE"
}
]
mountPoints セクションにマウントを追加します:
"mountPoints": [
{
"sourceVolume": "attribute-shared",
"containerPath": "/opt/attrb"
}
]
コンテナの entryPoint と command を変更します:
"entryPoint": [
"/opt/attrb/launch/ecs-fargate"
],
"command": [
"<original entrypoint + command>",
"-javaagent:/opt/attrb/jagent.jar"
]
注意
-javaagent:/opt/attrb/jagent.jar の行は Java/Scala アプリケーションにのみ適用されます。他のランタイムでは省略してください。
containerDefinitions に別のコンテナ定義を追加します:
{
"name": "attribute-sensor-loader",
"image": "quay.io/attribute/sensor:<tag>",
"essential": false,
"entryPoint": [
"load_attribute"
],
"mountPoints": [
{
"sourceVolume": "attribute-shared",
"containerPath": "/opt/attrb"
}
]
}
ステップ 2: volumes を更新
共有ボリュームを volumes セクションに追加します:
"volumes": [
{
"name": "attribute-shared"
}
]
注意事項
- これらの変更を行う際は、タスク定義の新しいリビジョンを作成し、その後 ECS サービスを更新することをおすすめします。
- パフォーマンスと可用性:
- センサーはコンテナ内の組み込みプロセスとして動作します。パフォーマンスへの影響を最小限に抑えるため、CPU 割り当てを 1 vCPU 増やすことをおすすめします。
- センサーが失敗しても、アプリケーションの機能には影響しない想定です。
- インストールのための Terraform によるオートメーションがサポートされています。
付録 A: 完全なタスク定義の例
{
"family": "<family>",
"containerDefinitions": [
{
"name": "<image-name>",
"image": "<image>",
"environment": [
{
"name": "CONFIG_ZPROBE_BEARER_TOKEN",
"value": "<token>"
},
{
"name": "CONFIG_ZPROBE_OTEL_ADDR",
"value": "otel-endpoint.app.attrb.io:443"
}
],
"workingDirectory": "/app",
"cpu": 0,
"essential": true,
"dependsOn": [
{
"containerName": "attribute-sensor-loader",
"condition": "COMPLETE"
}
],
"entryPoint": [
"/opt/attrb/launch/ecs-fargate"
],
"command": [
"/app/bin/mongo-scala",
"-javaagent:/opt/attrb/jagent.jar"
],
"mountPoints": [
{
"sourceVolume": "attribute-shared",
"containerPath": "/opt/attrb"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/go-zprobe-fargate",
"mode": "non-blocking",
"awslogs-create-group": "true",
"max-buffer-size": "25m",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs"
}
}
},
{
"name": "attribute-sensor-loader",
"image": "quay.io/attribute/sensor:<tag>",
"essential": false,
"entryPoint": [
"load_attribute"
],
"mountPoints": [
{
"sourceVolume": "attribute-shared",
"containerPath": "/opt/attrb"
}
]
}
],
"volumes": [
{
"name": "attribute-shared"
}
],
"executionRoleArn": "<role>",
"networkMode": "awsvpc",
"placementConstraints": [],
"requiresCompatibilities": ["FARGATE"],
"cpu": "4096",
"memory": "8192",
"runtimePlatform": {
"cpuArchitecture": "X86_64",
"operatingSystemFamily": "LINUX"
},
"enableFaultInjection": false
}
商標: AWS は Amazon.com, Inc. またはその関連会社の商標です。その他の商標はそれぞれの所有者に帰属します。