New Relic's ECS integration reports and displays performance data from your Amazon ECS environment.
Install overview
Before you install, it may help you to understand at a high level how our infrastructure agent (newrelic-infra) is deployed for these two launch types:
EC2 and EXTERNAL (ECS Anywhere) launch type: The daemon scheduling strategy deploys our agent onto an ECS cluster as a service (explained here in the AWS docs). This installs the agent in all EC2 instances of the cluster, and it then monitors ECS and Docker containers.
AWS Fargate launch type: In every task to monitor, you deploy our agent as a sidecar. You can optionally learn more about how AWS defines a sidecar.
Install options
Choose the install you want:
Install using CloudFormation
To help you install using AWS CloudFormation, we provide some CloudFormation templates that install the ECS integration onto your AWS account for EC2, EXTERNAL (ECS Anywhere), and AWS Fargate launch types.
To install using CloudFormation:
To register the ECS integration task, deploy this stack. Ensure you're deploying the stack to one or more of your desired regions. This stack creates the following resources:
- A secret that stores the New Relic .
- A policy to access the license key.
- An instance role to be used as an ECS task
ExecutionRole, with access to the license key. - A registration of the New Relic infrastructure ECS integration task, for EC2 and External (ECS Anywhere) launch type.
Follow the additional instructions for your launch type:
When you're done, see Next steps.
Install with automatic script
One install option is using our install script. To use the automatic install script:
Download the ECS integration installer:
bash$curl -O https://download.newrelic.com/infrastructure_agent/integrations/ecs/newrelic-infra-ecs-installer.shAdd execute permissions to the installer:
bash$chmod +x newrelic-infra-ecs-installer.shExecute it with
-hto see the documentation and requirements:bash$./newrelic-infra-ecs-installer.sh -hCheck that your AWS profile points to the same region where your ECS cluster was created:
bash$aws configure get regionus-east-1$$aws ecs list-clustersYOUR_CLUSTER_ARNSarn:aws:ecs:us-east-1:YOUR_AWS_ACCOUNT:cluster/YOUR_CLUSTERExecute the installer, specifying your and cluster name.
Additional steps for the Fargate launch type (not EC2 launch type):
Download the task definition example with the sidecar container to be deployed:
bash$curl -O https://download.newrelic.com/infrastructure_agent/integrations/ecs/newrelic-infra-ecs-fargate-example-latest.jsonTip
For Graviton, replace
"cpuArchitecture": "X86_64"with"cpuArchitecture": "ARM64".Notice that you must use the role you just created,
NewRelicECSTaskExecutionRole, as the task execution role.This role includes the following policies for all launch types:
NewRelicSSMLicenseKeyReadAccesswhich enables access to the SSM parameter with the license key.AmazonECSTaskExecutionRolePolicy
Add the container you want to monitor as a sidecar.
Important
When using AWS Fargate, you must also ensure the sidecar container has the environment variable
NRIA_IS_FORWARD_ONLYset totrueinside your task definition. Refer to the Fargate setup instructions under CloudFormation for configuration details and why this setting is critical.
When you're done, see Next steps.
Manual install
One install option is to manually do the steps that are done by the automatic installer script. We'll describe how this is done using the awscli tool:
Check that your AWS profile points to the same region where your ECS cluster was created:
bash$aws configure get regionus-east-1$$aws ecs list-clustersYOUR_CLUSTER_ARNSarn:aws:ecs:us-east-1:YOUR_AWS_ACCOUNT:cluster/YOUR_CLUSTERSave your as a Systems Manager (SSM) parameter:
bash$aws ssm put-parameter \>--name "/newrelic-infra/ecs/license-key" \>--type SecureString \>--description 'New Relic license key for ECS monitoring' \>--value "NEW_RELIC_LICENSE_KEY"Create an IAM policy to access the license key parameter:
bash$aws iam create-policy \>--policy-name "NewRelicSSMLicenseKeyReadAccess" \>--policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["ssm:GetParameters"],"Resource":["ARN_OF_LICENSE_KEY_PARAMETER"]}]}' \>--description "Provides read access to the New Relic SSM license key parameter"Create an IAM role to be used as the task execution role:
bash$aws iam create-role \>--role-name "NewRelicECSTaskExecutionRole" \>--assume-role-policy-document '{"Version":"2008-10-17","Statement":[{"Sid":"","Effect":"Allow","Principal":{"Service":"ecs-tasks.amazonaws.com"},"Action":"sts:AssumeRole"}]}' \>--description "ECS task execution role for New Relic infrastructure"Attach the policies
NewRelicSSMLicenseKeyReadAccessandAmazonECSTaskExecutionRolePolicyto the role:bash$aws iam attach-role-policy \>--role-name "NewRelicECSTaskExecutionRole" \>--policy-arn "POLICY_ARN"Choose your launch type for more instructions:
When you're done, see Next steps.
Did this doc help with your installation?
Next steps after install
After you've installed this integration:
- Wait a few minutes and then look for your data in the UI.
- Install our recommended ECS cloud integration, which gets you other ECS data, including information about clusters and services.
- See recommended alert conditions.
- Understand the AWS resources created by this process.
AWS resources created
When you install the ECS integration using default/recommended values, it does the following in AWS:
- Creates Systems Manager (SSM) parameter
/newrelic-infra/ecs/license-key. This system parameter contains the New Relic . - Creates IAM policy
NewRelicSSMLicenseKeyReadAccess, which enables access to the SSM parameter with the license key. - Creates IAM role
NewRelicECSTaskExecutionRoleused as the task execution role. This role includes the following policies:NewRelicSSMLicenseKeyReadAccess(created by the installer).AmazonECSTaskExecutionRolePolicy
- Registers the
newrelic-infraECS task definition for EC2 and External (ECS Anywhere) launch types. - Creates the following for EC2 launch type:
- The service
newrelic-infrafor the registered task, using a daemon scheduling strategy and EC2 launch type.
- The service
- Creates the following for EXTERNAL (ECS Anywhere) launch type:
- The service
newrelic-infra-externalfor the registered task, using a daemon scheduling strategy and EXTERNAL (ECS Anywhere) launch type.
- The service