Amazon ECS resource discovery with Patterns
The ServiceNow Discovery application uses the Amazon AWS - ECS pattern to find resources managed by the Amazon Elastic Container Service (Amazon ECS). This includes resources that are run on the Fargate launch type. Discovering some of these resources may require updating to the latest version of the Discovery and Service Mapping Patterns application from the ServiceNow Store.
Amazon ECS is a highly scalable, fast, container management service that makes it easy to run, stop, and manage Docker containers. AWS Fargate is a compute engine for Amazon ECS that enables AWS customers to run containers without having to manage servers or clusters.
Discovery uses the Amazon AWS - ECS pattern to run horizontal discovery.
Starting with Discovery and Service Mapping Patterns version 1.18.0, the Amazon AWS - ECS pattern supports the discovery of Amazon Elastic Container Registry (Amazon ECR) images. For more information on container scanning, see Scan container images.
Request apps on the Store
Visit the ServiceNow Store to view all the available apps, and for information about submitting requests to the store. For cumulative release notes information for all released apps, see the ServiceNow Store version history release notes.
Prerequisites
- Create AWS credentials with ECS resources viewing privileges
-
In the AWS console, create AWS credentials with privileges to view ECS resources. For more information, see: https://docs.aws.amazon.com/en_pv/AmazonECS/latest/userguide/get-set-up-for-amazon-ecs.html.주:The API requests use AWS Signature Version 4 to authenticate. When the correct credentials are provided, authentication is done internally for the Cloud API Call pattern steps.
- Create AWS cloud credential records or use temporary credentials
- In the ServiceNow AI Platform, create AWS credential records. You can also use a temporary credential generated by the AWS Security Token Service (AWS STS) for IAM roles. For more information, see Cloud credentials
- Create AWS cloud service accounts
-
- In the ServiceNow AI Platform, create AWS cloud service accounts using permanent or temporary AWS credentials. For more information, see Setting up AWS service accounts.
- In the Cloud Service Account record, select Discover Datacenters to find AWS Datacenters (LDCs) for the configured AWS cloud service account.
- Schedule an AWS discovery
- In the ServiceNow AI Platform, schedule either a full AWS pattern discovery or only an ECS pattern discovery.
- For more information on scheduling a cloud discovery, see Create a discovery schedule in Cloud Discovery Workspace.
- For more information about creating a serverless schedule for Amazon ECS discovery, see Create a serverless schedule for Amazon ECS discovery.
- Verify configuration of VM Object record to find the resource Tags
-
To enable the pattern to find the resource Tags, the parent ECS table (VM Object) must have a related entry for the cmdb_key_value table:
- In the ServiceNow AI Platform navigation bar, navigate to , and select CI Identifiers.
- Search for and open the VM Object record.
- Select the Related Entries tab and make sure it’s configured as shown in the VM Object Related Entry figure. If it isn’t, specify a new related entry: In the Related Entries related list,
select New, fill out the form, and then select Submit.
그림 1. VM Object Related Entry
Verify the REST API Permissions
Download the Cloud Discovery patterns spreadsheet so you can grant user permissions required for running the Discovery patterns. In addition to permissions, the spreadsheet also includes useful information such as pattern names, types, CI Classes, and links to vendor documentation. New patterns are available quarterly, so check periodically to be sure you have the latest version of the spreadsheet.
Data collected by Discovery during horizontal discovery
Discovery populates the data in the CMDB when running the Amazon AWS - ECS pattern.
| Field | Description |
|---|---|
| Object ID [object_id] | The Amazon Resource Name (ARN) that identifies the cluster. |
| Name [name] | A user-generated string used to identify the cluster. |
| Registered Container Instances Count [registered_container_instances_count] | The number of container instances registered to the cluster. The status of these container instances can be either ACTIVE or DRAINING. |
| Field | Description |
|---|---|
| Object ID [object_id] | The full ARN of the task definition. |
| Name [name] | The name of the family to which this task definition is registered. |
| Revision [revision] | The revision of the task in a particular family. This is the version number of the task definition in a family. |
| Network Mode [network_mode] | The Docker networking mode to use for the containers in the task. Valid values: None, bridge, awsvpc, host. |
| CPU [cpu] | The number of CPU units used by the task. |
| Memory [memory] | The amount of memory, in mebibyte (MiB), used by the task. |
| Field | Description |
|---|---|
| Object ID [object_id] | The ARN that identifies the task. |
| Name [name] | A user-generated string used to identify the task. |
| Launch Type [launch_type] | The launch type on which the task runs. |
| Operational status [operation_status] | The health status of the task, determined by the health of the essential containers in it. |
| CPU [cpu] | The number of CPU units used by the task, as stated in the task definition. |
| Memory [memory] | The amount of memory, in MiB, used by the task, as stated in the task definition. |
| Field | Description |
|---|---|
| Object ID [object_id] | The ARN that identifies the service. |
| Name [name] | The name of the service. |
| Launch Type [launch_type] | The launch type on which the service runs. |
| Scheduling Strategy [scheduling_strategy] | The scheduling strategy to use for the service. |
| Field | Description |
|---|---|
| Container id [container_id] | The ARN of the container. |
| Name [name] | The name of the container. |
| Status [status] | The last-known status of the container. |
| Operational status [operational_status] | The health status of the container. |
| CPU [cpu] | The number of CPU units set for the container. |
| Memory [memory] | The hard limit of memory, in MiB, set for the container. |
| Field | Description |
|---|---|
| Object ID [object_id] | The ARN that identifies the virtual machine (VM) instance. 주: Complete Virtual Machine Instance information is discovered in a different EC2 cloud pattern. In Amazon ECS resource discovery, only the object_id is parsed to aid with the unique identification of the CI. |
| Field | Description |
|---|---|
| Key [key] | The Tag key. |
| Value [value] | The Tag value. |
| Field | Description |
|---|---|
| Name [name] | Name of the Docker image. |
| Image Digest [image_digest] | Unique identifier for the Docker image. |
| Image ID [image_id] | 12-character length unique identifier for the Docker image. |
| Field | Description |
|---|---|
| Name [name] | Fully qualified name of the repository containing the Docker image. |
| Field | Description |
|---|---|
| Name [name] | The Docker image tag. |
| Category [category] | Fully qualified name of the repository containing the Docker image. |
On the Dependency Views map, you can see all discovered resources in your organization that are managed by Amazon ECS, and the relationships between them.
In this example, the AWS Cloud ECS Cluster CI is hosted on an AWS Datacenter. It runs two AWS Cloud ECS Tasks and two AWS Cloud ECS Services, and uses three Docker Containers.
CI relationships
These relationships are created to support Amazon ECS resource discovery.
| CI | Relationship | CI |
|---|---|---|
| AWS Cloud ECS Cluster [cmdb_ci_cloud_ecs_cluster] | Uses::Used by | Virtual Machine Instance [cmdb_ci_vm_instance] |
| AWS Cloud ECS Cluster [cmdb_ci_cloud_ecs_cluster] | Runs::Runs on | AWS Cloud ECS Service [cmdb_ci_cloud_ecs_service] |
| AWS Cloud ECS Cluster [cmdb_ci_cloud_ecs_cluster] | Runs::Runs on | AWS Cloud ECS Task [cmdb_ci_cloud_ecs_task] |
| AWS Cloud ECS Cluster [cmdb_ci_cloud_ecs_cluster] | Hosted on::Hosts | AWS datacenters |
| AWS Cloud ECS Cluster [cmdb_ci_cloud_ecs_cluster] | Extends from | Virtual Machine Object [cmdb_ci_vm_object] |
| AWS Cloud ECS Service [cmdb_ci_cloud_ecs_service] | Uses::Used by | AWS Cloud ECS TaskDefinition [cmdb_ci_cloud_ecs_task_definition] |
| AWS Cloud ECS Service [cmdb_ci_cloud_ecs_service] | Hosted on::Hosts | AWS Datacenters |
| AWS Cloud ECS Service [cmdb_ci_cloud_ecs_service] | Runs on::Runs | AWS Cloud ECS Cluster [cmdb_ci_cloud_ecs_cluster] |
| AWS Cloud ECS Service [cmdb_ci_cloud_ecs_service] | Extends from | Virtual Machine Object [cmdb_ci_vm_object] |
| AWS Cloud ECS Task [cmdb_ci_cloud_ecs_task] | Runs on::Runs | Virtual Machine Instance [cmdb_ci_vm_instance] |
| AWS Cloud ECS Task [cmdb_ci_cloud_ecs_task] | Runs on::Runs | Docker Container [cmdb_ci_docker_container] |
| AWS Cloud ECS Task [cmdb_ci_cloud_ecs_task] | Uses::Used by | AWS Cloud ECS TaskDefinition [cmdb_ci_cloud_ecs_task_definition] |
| AWS Cloud ECS Task [cmdb_ci_cloud_ecs_task] | Hosted on::Hosts | AWS Datacenters |
| AWS Cloud ECS Task [cmdb_ci_cloud_ecs_task] | Runs on::Runs | AWS Cloud ECS Cluster [cmdb_ci_cloud_ecs_cluster] |
| AWS Cloud ECS Task [cmdb_ci_cloud_ecs_task] | Extends from | Virtual Machine Object [cmdb_ci_vm_object] |
| AWS Cloud ECS TaskDefinition [cmdb_ci_cloud_ecs_task_definition] | Used by::Uses | AWS Cloud ECS Service [cmdb_ci_cloud_ecs_service] |
| AWS Cloud ECS TaskDefinition [cmdb_ci_cloud_ecs_task_definition] | Used by::Uses | AWS Cloud ECS Task [cmdb_ci_cloud_ecs_task] |
| AWS Cloud ECS TaskDefinition [cmdb_ci_cloud_ecs_task_definition] | Hosted on::Hosts | AWS Datacenters |
| AWS Cloud ECS TaskDefinition [cmdb_ci_cloud_ecs_task_definition] | Extends from | Virtual Machine Object [cmdb_ci_vm_object] |
| Container Repository [cmdb_ci_container_repository] | Hosted on::Hosts | AWS Datacenter [cmdb_ci_aws_datacenter] |
| Container Repository Entry [cmdb_ci_container_repository_entry] | Hosted on::Hosts | Container Repository [cmdb_ci_container_repository] |
| Docker Container [cmdb_ci_docker_container] | Hosted on::Hosts | AWS Datacenters |
| Docker Container [cmdb_ci_docker_container] | Runs::Runs on | AWS Cloud ECS Task [cmdb_ci_cloud_ecs_task] |
| Docker Container [cmdb_ci_docker_container] | Used by::Uses | AWS Cloud ECS Cluster [cmdb_ci_cloud_ecs_cluster] |
| Docker Image [cmdb_ci_docker_image] | Provisioned From::Provisioned | Container Repository Entry [cmdb_ci_container_repository_entry] |
| Docker Image [cmdb_ci_docker_image] | Instantiates::Instantiated by | Docker Container [cmdb_ci_docker_container] |