

# AWS integration for Amazon Location Service
<a name="integration"></a>

Amazon Location Service is integrated with various AWS services for efficient authentication, monitoring, management and development.

**Monitor**  
+ **Amazon CloudWatch** – View metrics on service usage and health, including requests, latency, faults, and logs. For more information, see [Monitor with Amazon CloudWatch](cloudwatch.md).
+ **AWS CloudTrail** – Log and monitor your API calls, which include actions taken by a user, role or an AWS service. For more information, see [Monitor and log with AWS CloudTrail](cloudtrail.md).

**Manage**  
+ **AWS CloudFormation** – Amazon Location is integrated with AWS CloudFormation, a service that helps you to model and set up your AWS resources so that you can spend less time creating and managing your resources and infrastructure. For more information, see [Create resources with AWS CloudFormation](cloudformation.md).
+ **Service Quotas** – Use the Service Quotas console and AWS CLI to request changes to your adjustable quotas. For more information, see [Manage quotas with Service Quotas](manage-quotas.md).
+ **Tags** – Use resource tagging in Amazon Location to create tags to categorize your resources by purpose, owner, environment, or criteria. Tagging your resources helps you manage, identify, organize, search, and filter your resources. For more information, see [Manage resources with Tags](manage-resources.md).

**Authenticate**  
+ **Amazon Cognito** – You can use Amazon Cognito authentication as an alternative to directly using AWS Identity and Access Management (IAM) with both frontend SDKs and direct HTTPS requests. For more information, see [Use Amazon Cognito to authenticate](authenticating-using-cognito.md).
+ **IAM** – AWS Identity and Access Management (IAM) is an AWS service that helps an administrator securely control access to AWS resources. IAM administrators control who can be authenticated (signed in) and authorized (have permissions) to use Amazon Location Service resources. For more information, see [Use AWS Identity and Access Management to authenticate](security-iam.md).

**Value added**  
+ **Amazon EventBridge** – Enable an event-driven application architecture so you can use AWS Lambda functions to activate other parts of your application and work flows. For more information, see [React to Amazon Location Service events with Amazon EventBridge](location-events.md).
+ **AWS IoT** – The AWS IoT Core rules engine stores queries about your devices' message topics and enables you to define actions for sending messages to other AWS services, such as Amazon Location Service. Devices that are aware of their location as coordinates can have their locations forwarded to Amazon Location through the rules engine. For more information, see [Track using AWS IoT and MQTT with Amazon Location Service](tracking-using-mqtt.md).

**Developer tool**  
+ **SDKs** – Amazon Location Service offers a variety of tools for developers to build location-enabled applications. These include the standard AWS SDKs, mobile and web SDKs. For more information, see [SDKs and frameworks for Amazon Location Service](dev-sdks.md).
+ **AWS CLI** – The AWS Command Line Interface (AWS CLI) is an open source tool that enables you to interact with AWS services using commands in your command-line shell. With minimal configuration. For more information, see [AWS Command Line Interface](https://docs.aws.amazon.com/cli/latest/reference/location/) or learn more about [AWS CLI](https://docs.aws.amazon.com/cli/).
+ **Sample code** – Sample code uses AWS SDKs, mobile and web SDKs, MapLibre to demonstrate how you can use Amazon Location. For more information, see [samples](https://location.aws.com/samples).
+ **Amazon Location Service console** – Use the Amazon Location console to learn about APIs, resources, and to get started with a visual and interactive learning tool. For more information, see the [Amazon Location Service console](https://console.aws.amazon.com/location/explore/home).

**Cost and billing**  
+ **AWS Billing and Cost Management** – Service provides helps to you pay your bills and optimize your costs. Amazon Web Services bills your account for usage, which ensures that you pay only for what you use. For more information, see [Pricing model](pricing.md) or [Manage billing and costs with AWS Billing and Cost Management](manage-billing.md).

# Resource Management
<a name="resource-management"></a>

Resource management provides tools and processes to manage quotas, organize resources with tags, control costs, and automate resource creation using AWS CloudFormation. These capabilities enable you to efficiently allocate, monitor, and manage your resources within Amazon Location.

Use these tools to maintain operational efficiency by setting service limits, tagging resources for better organization, monitoring your expenses, and using infrastructure as code with CloudFormation to create and manage resources programmatically.

**Topics**
+ [Manage quotas with Service Quotas](manage-quotas.md)
+ [Manage resources with Tags](manage-resources.md)
+ [Manage billing and costs with AWS Billing and Cost Management](manage-billing.md)
+ [Create resources with AWS CloudFormation](cloudformation.md)

# Manage quotas with Service Quotas
<a name="manage-quotas"></a>

Service Quotas console allows you to [request quota increases or decrease quota](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas) for adjustable quotas. Service quotas are the maximum number of API calls or resources you can have per AWS account and AWS Region. When requesting a quota increase, select the Region you require the quota increase in since most quotas are Region-specific. Amazon Location Service denies additional requests that exceed the service quota.

 Rate limits (quotas that start with Rate of...) are the maximum number of requests per second, with a burst rate of 80 percent of the limit within any part of the second, defined for each API operation. Operations with rate limits increased for an account through Service Quotas may have a burst rate lower than 80 percent of the increased rate limit. Amazon Location Service throttles requests that exceed the operation's rate limit. 

## Managing your Amazon Location service quotas
<a name="manage-quotas_how"></a>

 Amazon Location Service is integrated with Service Quotas, an AWS service that enables you to view and manage your quotas from a central location. For more information, see [ What Is Service Quotas?](https://docs.aws.amazon.com/servicequotas/latest/userguide/intro.html) in the *Service Quotas User Guide*.

 Service Quotas makes it easy to look up the value of your Amazon Location service quotas. 

------
#### [ AWS Management Console ]

1. Open the [Service Quotas console](https://console.aws.amazon.com/servicequotas).

1. In the navigation pane, choose **AWS services**.

1. From the **AWS services** list, search for and select **Amazon Location**.

1. In the **Service quotas** list, you can see the service quota name, applied value (if it is available), AWS default quota, and whether the quota value is adjustable.

1. To view additional information about a service quota, such as the description, choose the quota name.

1. (Optional) To request a quota increase, select the quota that you want to increase, select **Request quota increase**, enter or select the required information, and select **Request**.

 To work more with service quotas using the console, see the *Service Quotas User Guide*. To request a quota increase, see [Requesting a quota increase](https://docs.aws.amazon.com/servicequotas/latest/userguide/request-quota-increase.html) in the *Service Quotas User Guide*. 

------
#### [ AWS CLI ]

Run the following command to view the default Amazon Location quotas.

```
aws service-quotas list-aws-default-service-quotas \
    --query 'Quotas[*].{Adjustable:Adjustable,Name:QuotaName,Value:Value,Code:QuotaCode}' \
    --service-code geo \
    --output table
```

To work more with service quotas using the AWS CLI, see the Service Quotas section in the *AWS CLI Command Reference*. To request a quota increase, see [https://docs.aws.amazon.com/cli/latest/reference/service-quotas/request-service-quota-increase.html](https://docs.aws.amazon.com/cli/latest/reference/service-quotas/request-service-quota-increase.html) in the *AWS CLI Command Reference*. 

------

## FAQ
<a name="manage-quotas_faq"></a>

**What are the default quotas for Amazon Location Service resources?**  
Amazon Location Service sets default quotas for APIs to help manage service capacity, which can be viewed in the [AWS Service Quotas Management Console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas). You can find links to all of these in the [Monitoring your Amazon Location service quotas](#manage-quotas_monitor) section below.

**How can I request an increase in quotas for Amazon Location Service?**  
You can request an increase in Amazon Location Service quotas through the [self-service console](https://console.aws.amazon.com/servicequotas/home#!/services/geo/quotas), for up to 2x the default limit for each API. For quota limits exceeding 2x the default limit, request in the self service console and it will submit a support ticket. Alternately, you can connect your premium support team 

**Are there additional costs associated with requesting higher quotas for Amazon Location Service?**  
There are no direct charges for quota increase requests, but higher usage levels may lead to increased service costs based on the additional resources consumed. 

## Monitoring your Amazon Location service quotas
<a name="manage-quotas_monitor"></a>

 You can monitor your usage against your quotas with Amazon CloudWatch. For more information, see [Monitor with Amazon CloudWatch](cloudwatch.md).

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/location/latest/developerguide/manage-quotas.html)

## Learn more
<a name="manage-quotas_learn"></a>

 To learn more about service quotas, see the [Service Quotas documentation](https://docs.aws.amazon.com/servicequotas/latest/userguide/intro.html). 

# Manage resources with Tags
<a name="manage-resources"></a>

Use resource tagging in Amazon Location to create tags to categorize your resources by purpose, owner, environment, or criteria. Tagging your resources helps you manage, identify, organize, search, and filter your resources. For example, with AWS Resource Groups, you can create groups of AWS resources based on one or more tags or portions of tags. You can also create groups based on their occurrence in an AWS CloudFormation stack. Using Resource Groups and Tag Editor, you can consolidate and view data for applications that consist of multiple services, resources, and Regions in one place. For more information on [Common Tagging Strategies](https://docs.aws.amazon.com/tag-editor/latest/userguide/best-practices-and-strats.html), see the *AWS General Reference*.

Each tag is a label consisting of a key and value that you define: 
+ **Tag key** – A general label that categorizes the tag values. For example, `CostCenter`. 
+ **Tag value** – An optional description for the tag key category. For example, `MobileAssetTrackingResourcesProd`. 

This topic helps you get started with tagging by reviewing tagging restrictions. It also shows you how to create tags and use tags to track your AWS cost for each active tag by using cost allocation reports. 

For more information about: 
+ Tagging best practices, see [Tagging AWS resources](https://docs.aws.amazon.com/tag-editor/latest/userguide/best-practices-and-strats.html) in the *AWS General Reference*.
+ Using tags to control access to AWS resources, see [Controlling access to AWS resources using tags](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html) in the *AWS Identity and Access Management User Guide*. 

## Restrictions
<a name="manage-resources_restrictions"></a>

**Note**  
If you add a new tag with the same tag key as an existing tag, the new tag overwrites the existing tag.

Tagging allows you to organize and manage your resources more effectively. This page outlines the specific rules and constraints that govern the use of tags within Amazon Location Service. By understanding these tagging restrictions, you can ensure compliance with best practices and avoid potential issues when implementing tagging strategies for your location-based resources and applications. 

The following basic restrictions apply to tags: 
+ Maximum tags per resource: 50 
+ For each resource, each tag key must be unique, and each tag key can have only one value. 
+ Maximum key length: 128 Unicode characters in UTF-8 
+ Maximum value length: 256 Unicode characters in UTF-8 
+ The allowed characters across services are: letters, numbers, and spaces representable in UTF-8, and the following characters: \$1 - = . \$1 : / @. 
+ Tag keys and values are case-sensitive. 
+ The `aws:` prefix is reserved for AWS use. If a tag has a tag key with this prefix, then you can't edit or delete the tag's key or value. Tags with the aws: prefix don't count against your tags per resource limit. 

## Grant permission to tag resources
<a name="manage-resources_grant-permission"></a>

You can use IAM policies to control access to your Amazon Location resources and grant permission to tag a resource on creation. In addition to granting permission to create resources, the policy can include Action permissions to allow tagging operations: 
+ `geo:TagResource` – Allows a user to assign one or more tags to a specified Amazon Location resource. 
+ `geo:UntagResource` – Allows a user to remove one or more tags from a specified Amazon Location resource. 
+ `geo:ListTagsForResource` – Allows a user to list all the tags assigned to an Amazon Location resource. 

The following is a policy example to allow a user to create a geofence collection and tag resources: 

```
{
"Version": "2012-10-17",		 	 	 
    "Statement": [
        {
"Sid": "AllowTaggingForGeofenceCollectionOnCreation",
            "Effect": "Allow",
            "Action": [
                "geo:CreateGeofenceCollection",
                "geo:TagResource"
            ],
            "Resource": "arn:aws:geo:region:accountID:geofence-collection/*"
    ]
}
```

## Add a tag to a resource
<a name="manage-resources_add-tag"></a>

 You can add tags when creating your resources using the Amazon Location console, the AWS CLI, or the Amazon Location APIs: 
+ [Manage your geofence collection resources](managing-geofence-collections.md) 
+ [Create a tracker](start-create-tracker.md) 

**To tag existing resources, edit or delete tags**

1.  Open the [Amazon Location console](https://console.aws.amazon.com/location). 

1.  In the left navigation pane, choose the resource you want to tag. For example, **Maps**. 

1.  Choose a resource from the list. 

1.  Choose **Manage tags** to add, edit, or delete your tags. 

## How to use tags
<a name="manage-resources_how-to"></a>

 You can use tags for cost allocation to track your AWS cost in detail. After you activate the cost allocation tags, AWS uses the cost allocation tags to organize your resource billing on your cost allocation report. This helps you categorize and track your usage costs. 

Amazon Location supports [User-defined](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/custom-tags.html) – Tags. These are custom tags that you create. The user-defined tags use the `user:` prefix, for example, `user:CostCenter`.

 You must activate each tag type individually. After your tags are activated, you can [enable AWS Cost Explorer](https://docs.aws.amazon.com/cost-management/latest/userguide/ce-enable.html) or view your monthly cost allocation report. 

**To activate user-defined tags**

1.  Open the [Billing and Cost Management console](https://console.aws.amazon.com/billing). 

1.  In the left navigation pane, choose **Cost Allocation Tags**. 

1.  Under the **User-Defined Cost Allocation Tags** tab, select the tag keys you want to activate. 

1.  Choose **Activate**. 

 After you activate your tags, AWS generates a [monthly Cost Allocation Report](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/configurecostallocreport.html) for your resource usage and cost. This cost allocation report includes all of your AWS costs for each billing period, including tagged and untagged resources. For more information, see [Organizing and tracking costs using AWS cost allocation tags](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html) in the *AWS Billing User Guide*. 

### Control access to resources using tags
<a name="manage-resources_control-access"></a>

 AWS Identity and Access Management (IAM) policies support tag-based conditions, which enables you to manage authorization for your resources based on specific tags key and values. For example, an IAM role policy can include conditions to limit access to specific environments, such as development, test, or production, based on tags. For more information, see the topic on [control resource access based on tags](https://docs.aws.amazon.com/location/latest/developerguide/security-iam.html#security_iam_id-based-policy-examples). 

# Manage billing and costs with AWS Billing and Cost Management
<a name="manage-billing"></a>

AWS Billing and Cost Management is a web service that provides features that helps you pay your bills and optimize your costs. Amazon Web Services bills your account for usage, which ensures that you pay only for what you use. 

**How to see bills and manage cost**

1. Open [Billing and Cost Management](https://console.aws.amazon.com/billing) in the AWS Management Console. 

1. Search for location service in Amazon Web Services, Inc. charges by service 

1. Choose **[\$1] Location service** 

1. Choose **[\$1] Region Name** 

To learn more, see [Billing and Cost Management](https://console.aws.amazon.com/costmanagement/home#/getting-started) in the AWS Management Console. 

# Create resources with AWS CloudFormation
<a name="cloudformation"></a>

Amazon Location Service is integrated with CloudFormation, a service that helps you to model and set up your AWS resources so that you can spend less time creating and managing your resources and infrastructure. You create a template that describes all the AWS resources that you want (such as Amazon Location resources), and CloudFormation provisions and configures those resources for you. 

When you use CloudFormation, you can reuse your template to set up your Amazon Location resources consistently and repeatedly. Describe your resources once, and then provision the same resources over and over in multiple AWS accounts and Regions. 

## Related CloudFormation templates
<a name="cloudformation_templates"></a>

To provision and configure resources for Amazon Location and related services, you must understand [CloudFormation templates](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-guide.html). Templates are formatted text files in JSON or YAML. These templates describe the resources that you want to provision in your CloudFormation stacks. If you're unfamiliar with JSON or YAML, you can use Infrastructure Composer to help you get started with CloudFormation templates. For more information, see [Infrastructure Composer](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/infrastructure-composer-for-cloudformation.html) in the *CloudFormation User Guide*. 

Amazon Location supports creating the following resource types in CloudFormation: 
+ [AWS::Location::Tracker](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-location-tracker.html) 
+ [AWS::Location::TrackerConsumer](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-location-trackerconsumer.html) 
+ [AWS::Location::GeofenceCollection](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-location-geofencecollection.html) 

For more information, including examples of JSON and YAML templates for Amazon Location resources, see the [Amazon Location Service resource type reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/AWS_Location.html) in the *CloudFormation Template Reference*. 

## Learn more about CloudFormation
<a name="cloudformation_learn"></a>

To learn more about CloudFormation, see the following resources: 
+ [CloudFormation](https://aws.amazon.com/cloudformation) 
+ [CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html) 
+ [CloudFormation API Reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/Welcome.html) 
+ [CloudFormation Command Line Interface User Guide](https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/what-is-cloudformation-cli.html) 

# Monitoring and Auditing
<a name="monitoring-auditing"></a>

Monitoring and Auditing provides capabilities to track, monitor, and log activities in your Amazon Location Services environment. With Amazon CloudWatch and AWS CloudTrail, you can ensure the reliability, security, and compliance of your applications.

These tools help you observe resource performance metrics, detect anomalies, and log API activity for auditing and troubleshooting. Use them to enhance operational insights, diagnose issues, and ensure adherence to compliance standards.

**Topics**
+ [Monitor with Amazon CloudWatch](cloudwatch.md)
+ [Monitor and log with AWS CloudTrail](cloudtrail.md)

# Monitor with Amazon CloudWatch
<a name="cloudwatch"></a>

Amazon CloudWatch monitors your AWS resources and the applications that you run on AWS in near-real time. You can monitor Amazon Location resources using CloudWatch, which collects raw data and processes metrics into meaningful statistics in near-real time. You can view historical information for up to 15 months, or search metrics to view in the Amazon CloudWatch console for more perspective on how your application or service is performing. You can also set alarms by defining thresholds, and send notifications or take actions when those thresholds are met. 

 For more information, see the [Amazon CloudWatch User Guide](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/)

**Topics**
+ [Amazon Location Service metrics and dimensions](#metrics-exported-to-cloudwatch)
+ [View Amazon Location Service metrics](#view-metrics)
+ [Create CloudWatch alarms for Amazon Location Service metrics](#create-alarms)
+ [Use CloudWatch to monitor usage against quotas](#alarms-on-quotas)
+ [CloudWatch metric examples for Amazon Location Service](#example-alarms)

## Amazon Location Service metrics and dimensions
<a name="metrics-exported-to-cloudwatch"></a>

Metrics are time-ordered data points that are exported to CloudWatch. A dimension is a name/value pair that identifies the metric. For more information, see [Using CloudWatch metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/working_with_metrics.html) and [CloudWatch dimensions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Dimension) in the Amazon CloudWatch User Guide.

**Note**  
The result is approximate because of the distributed architecture of Amazon Location Service. In most cases, the count should be close to the actual number of API operations being sent.

### Amazon Location Service metrics
<a name="service-metrics"></a>

The following are metrics that Amazon Location Service exports to CloudWatch in the `AWS/Location` namespace.


| Metric | Description | Dimensions | 
| --- | --- | --- | 
|  `CallCount`  |  The number of calls made to a given API endpoint.  Valid Statistic: Sum Units: Count  |  OperationName OperationName, ResourceName ApiKeyName, OperationName ApiKeyName, OperationName, ResourceName OperationName, OperationVersion OperationName, OperationVersion, ResourceName ApiKeyName, OperationName, OperationVersion ApiKeyName, OperationName, OperationVersion, ResourceName  | 
|  `ErrorCount`  |  The number of error responses from calls made to a given API endpoint. Valid Statistic: Sum Units: Count  |  OperationName OperationName, ResourceName ApiKeyName, OperationName ApiKeyName, OperationName, ResourceName  | 
|  `SuccessCount`  |  The number of successful calls made to a given API endpoint.  Valid Statistic: Sum Units: Count  |  OperationName OperationName, ResourceName ApiKeyName, OperationName ApiKeyName, OperationName, ResourceName  | 
|  `CallLatency`  |  The amount of time the operation takes to process and return a response when a call is made to a given API endpoint. Valid Statistic: Average Units: Milliseconds  |  OperationName OperationName, ResourceName ApiKeyName, OperationName ApiKeyName, OperationName, ResourceName  | 

### Amazon Location Service dimensions for metrics
<a name="service-dimensions"></a>

You can use the dimensions in the following table to filter Amazon Location Service metrics.


| Dimension | Description | 
| --- | --- | 
|  OperationName   |  Filters Amazon Location metrics for API operation with the specified operation name.  | 
|  OperationName, ResourceName  |  Filter Amazon Location metrics for API operation with the specified operation name and resource name.  | 
|  ApiKeyName, OperationName  |  Filter Amazon Location metrics for API operation with the specified operation name and using given API key name.  | 
|  ApiKeyName, OperationName, ResourceName  |  Filter Amazon Location metrics for API operation with the specified operation name, resource name and using given API key name.  | 
|  OperationName, OperationVersion  |  Filters Amazon Location metrics for API operation with the specified operation name.  Amazon Location Service standalone Maps, Places, and Routes will be export metric to this dimension.   | 
|  OperationName, OperationVersion, ResourceName   |  Filter Amazon Location metrics for API operation with the specified operation name, version, and Amazon Location resource name.  Amazon Location standalone Maps, Places, and Routes will be export metric to this dimension.   | 
|  ApiKeyName, OperationName, OperationVersion  |  Filter Amazon Location metrics for API operation with the specified operation name, version, and using given API key name.  Amazon Location standalone Maps, Places, and Routes will be export metric to this dimension.   | 
|  ApiKeyName, OperationName, OperationVersion, ResourceName   |  Filter Amazon Location metrics for API operation with the specified operation name, version, resource name and using given API key name.  Amazon Location standalone Maps, Places, and Routes will be export metric to this dimension.   | 

## View Amazon Location Service metrics
<a name="view-metrics"></a>

You can view metrics for Amazon Location Service on the Amazon CloudWatch console or by using the Amazon CloudWatch API.

**To view metrics using the CloudWatch console**

**Example**  

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Metrics**.

1. On the **All metrics tab**, choose the **Location** namespace.

1. Select the type of metric to view.

1. Select the metric and add it to the chart.
For more information, see [View Available Metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/viewing_metrics_with_cloudwatch.html) in the *Amazon CloudWatch User Guide*. 

## Create CloudWatch alarms for Amazon Location Service metrics
<a name="create-alarms"></a>

You can use CloudWatch to set alarms on your Amazon Location Service metrics. For example, you can create an alarm in CloudWatch to send an email whenever an error count spike occurs. 

The following topics give you a high-level overview of how to set alarms using CloudWatch. For detailed instructions, see [Using Alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Alarms.html) in the *Amazon CloudWatch User Guide*. 

**To set alarms using the CloudWatch console**

**Example**  

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose **Alarm**.

1. Choose **Create Alarm**.

1. Choose **Select metric**.

1. On the **All metrics** tab, select the **Location** namespace.

1. Select a metric category.

1. Find the row with the metric you want to create an alarm for, then select the check box next to this row.

1. Choose **Select metric**.

1. Under **Metric**, fill in the values.

1. Specify the alarm **Conditions**.

1. Choose **Next**.

1. If you want to send a notification when the alarm conditions are met:
   + Under **Alarm state trigger**, select the alarm state to prompt a notification to be sent.
   + Under **Select an SNS topic**, choose **Create new topic** to create a new Amazon Simple Notification Service (Amazon SNS) topic. Enter the topic name and the email to send the notification to. 
   + Under **Send a notification to** enter additional email addresses to send the notification to.
   + Choose** Add notification**. This list is saved and appears in the field for future alarms.

1. When done, choose **Next**.

1. Enter a name and description for the alarm, then choose **Next**.

1. Confirm the alarm details, then choose **Next**.

**Note**  
When creating a new Amazon SNS topic, you must verify the email address before a notification can be sent. If the email is not verified, the notification will not be received when an alarm is initiated by a state change.

For more information about how to set alarms using the CloudWatch console, see [Create an Alarm that Sends Email](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Alarms.html) in the *Amazon CloudWatch User Guide*. 

## Use CloudWatch to monitor usage against quotas
<a name="alarms-on-quotas"></a>

You can create Amazon CloudWatch alarms to notify you when your utilization of a given quota exceeds a configurable threshold. This enables you to recognize when you are close to your quota limits, and either adapt your utilization to avoid cost overruns, or request a quota increase, if needed. 

For information about how to use CloudWatch to monitor quotas, see [ Visualizing your service quotas and setting alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Quotas-Visualize-Alarms.html) in the * Amazon CloudWatch User Guide*.

## CloudWatch metric examples for Amazon Location Service
<a name="example-alarms"></a>

You can use the [GetMetricData](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) API to retrieve metrics for Amazon Location. 
+ For example, you can monitor `CallCount` and set an alarm for when a drop in number occurs. 

  Monitoring the `CallCount` metrics for `SendDeviceLocation` can help give you perspective on tracked assets. If the `CallCount` drops, it means that tracked assets, such as a fleet of trucks, have stopped sending their current locations. Setting an alarm for this can help notify you an issue has occurred.
+ For another example, you can monitor `ErrorCount` and set an alarm for when a spike in number occurs.

  Trackers must be associated with geofence collections in order for device locations to be evaluated against geofences. If you have a device fleet that requires continuous location updates, seeing the `CallCount` for `BatchEvaluateGeofence` or `BatchPutDevicePosition` drop to zero indicates that updates are no longer flowing.

The following is an example output for [GetMetricData](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_GetMetricData.html) with the metrics for `CallCount` and `ErrorCount` for creating map resources.

```
{
"StartTime": 1518867432,
  "EndTime": 1518868032,
  "MetricDataQueries": [
    {
"Id": "m1",
      "MetricStat": {
"Metric": {
"Namespace": "AWS/Location",
          "MetricName": "CallCount",
          "Dimensions": [
            {
"Name": "SendDeviceLocation",
              "Value": "100"
            }
          ]
        },
        "Period": 300,
        "Stat": "SampleCount",
        "Unit": "Count"
      }
    },
    {
"Id": "m2",
      "MetricStat": {
"Metric": {
"Namespace": "AWS/Location",
          "MetricName": "ErrorCount",
          "Dimensions": [
            {
"Name": "AssociateTrackerConsumer",
              "Value": "0"
            }
          ]
        },
        "Period": 1,
        "Stat": "SampleCount",
        "Unit": "Count"
      }
    }
  ]
}
```

# Monitor and log with AWS CloudTrail
<a name="cloudtrail"></a>

AWS CloudTrail is a service that provides a record of actions taken by a user, role, or an AWS service. CloudTrail records all API calls as events. You can use Amazon Location Service with CloudTrail to monitor your API calls, which include calls from the Amazon Location Service console and AWS SDK calls to the Amazon Location Service API operations. 

CloudTrail is automatically enabled when you create your AWS account. When activity occurs in Amazon Location Service, that activity is recorded in a CloudTrail event along with other AWS service events in **Event history**. You can view, search, and download event history for the past 90 days per AWS Region.

For more information about CloudTrail, see the [AWS CloudTrail User Guide](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/). There are no CloudTrail charges for viewing the **Event history**.

For an ongoing records of events in your AWS account past 90 days, including events from Amazon Location Service, create a trail or a [CloudTrail Lake](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-lake.html) data store.

**CloudTrail trails**

A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. When you create a trail in AWS Management Console, the trail applies to all AWS Regions. The trail logs events from all regions in the AWS Partition and delivers the log files to the S3 bucket that you specify. Additionally, you can configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs. 

For more information on how to create a trail, see [Overview for Creating a Trail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html). 

For a list of CloudTrail supported services and integrations, see [CloudTrail Supported Services and Integrations](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-aws-service-specific-topics.html#cloudtrail-aws-service-specific-topics-integrations).

You can deliver one copy of your ongoing management events to your Amazon S3 bucket at no charge from CloudTrail by creating a trail. However, there are Amazon S3 storage charges. 

For more information about CloudTrail pricing, see [AWS CloudTrail pricing](https://aws.amazon.com/cloudtrail/pricing/).

For information about Amazon S3 pricing, see [Amazon S3 pricing](https://aws.amazon.com/s3/pricing/).

**CloudTrail Lake event data stores**

CloudTrail Lake lets you run SQL-based queries on your events. Events are aggregated into *event data stores*, which are immutable collections of events based on criteria that you select by applying [advanced event selectors](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-lake-concepts.html#adv-event-selectors). The selectors that you apply to an event data store control which events persist and are available for you to query. 

For more information about CloudTrail Lake, see [Working with AWS CloudTrail Lake](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-lake.html).

CloudTrail Lake event data stores and queries incur costs. When you create an event data store, you choose the [pricing option](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-lake-manage-costs.html#cloudtrail-lake-manage-costs-pricing-option) you want to use for the event data store. The pricing option determines the cost for ingesting and storing events, and the default and maximum retention period for the event data store. 

For more information about CloudTrail pricing, see [AWS CloudTrail pricing](https://aws.amazon.com/cloudtrail/pricing/).

**Topics**
+ [Amazon Location management events in CloudTrail](#cloudtrail-management-events)
+ [Amazon Location data events in CloudTrail](#cloudtrail-data-events)
+ [Learn about Amazon Location Service log file entries](#cloudtrail-log-entries)
+ [Example: CloudTrail log file entry for an Amazon Location management event](#cloudtrail-management-event-example)
+ [Example: CloudTrail log file entry for an Amazon Location data event](#cloudtrail-data-event-example)

## Amazon Location management events in CloudTrail
<a name="cloudtrail-management-events"></a>

You can view Amazon Location management events in your CloudTrail event history. These events include all API calls that manage Amazon Location resources and configurations. For a complete list of supported actions, refer to the [Amazon Location Service API references](https://docs.aws.amazon.com/location/latest/APIReference/Welcome.html). 

## Amazon Location data events in CloudTrail
<a name="cloudtrail-data-events"></a>

 Data events provide information about operations performed directly on a resource. These events, also known as data plane operations, can be high-volume. By default, CloudTrail does not log data events, and the CloudTrail Event History does not record them. You incur additional charges when you enable data events. For more information about CloudTrail pricing, see [AWS CloudTrail Pricing](https://aws.amazon.com/cloudtrail/pricing/). 

 You can choose which Amazon Location resource types log data events by using the CloudTrail console, AWS CLI, or CloudTrail API operations. For instructions on how to enable and manage data events, see [ Logging data events with the AWS Management Console ](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html#logging-data-events-console) and [ Logging data events with the AWS Command Line Interface ](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html#creating-data-event-selectors-with-the-AWS-CLI). 

The following table lists the Amazon Location resource types for which you can log data events:


**Supported Amazon Location Data Events**  

| Data event type (console) | resources.type value | Data APIs logged to CloudTrail | 
| --- | --- | --- | 
| Geo Maps | AWS::GeoMaps::Provider | See the Amazon [GeoMaps API](https://docs.aws.amazon.com/location/latest/APIReference/Welcome.html#Welcome_Amazon_Location_Service_Maps) reference | 
| Geo Places | AWS::GeoPlaces::Provider | See the Amazon [GeoPlaces API](https://docs.aws.amazon.com/location/latest/APIReference/Welcome.html#Welcome_Amazon_Location_Service_Places) reference | 
| Geo Routes | AWS::GeoRoutes::Provider | See the Amazon [GeoRoutes API](https://docs.aws.amazon.com/location/latest/APIReference/Welcome.html#Welcome_Amazon_Location_Service_Routes) reference | 

**Note**  
Amazon Location does not publish CloudTrail events for the following GeoMaps APIs: `GetStyleDescriptor`, `GetGlyphs`, and `GetSprites`. These APIs are free of charge and do not require authentication. 

 You can configure advanced event selectors to filter events by `eventName`, `readOnly`, and `resources.ARN`. This helps you log only those events that matter to you. For more information, see [ AdvancedFieldSelector ](https://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_AdvancedFieldSelector.html). 

## Learn about Amazon Location Service log file entries
<a name="cloudtrail-log-entries"></a>

 When you configure a trail, CloudTrail delivers events as log files to an S3 bucket that you specify, or to Amazon CloudWatch Logs. For more information, see [ Working with CloudTrail log files ](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-working-with-log-files.html) in the AWS CloudTrail User Guide. 

 CloudTrail log files can contain one or more log entries. Each event entry represents a single request from any source and includes details such as the requested operation, the date and time of the operation, request parameters, and more. 

**Note**  
CloudTrail log files are not an ordered stack trace of API calls. They do not appear in chronological order. To determine the order of operations, use `[eventTime](https://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_Event.html)`. 

 Every event or log entry contains information about who made the request. This identity information helps you determine: 
+ Whether the request was made with root or user credentials.
+ Whether the request was made with temporary security credentials for a role or a federated user.
+ Whether the request was made by another AWS service.

## Example: CloudTrail log file entry for an Amazon Location management event
<a name="cloudtrail-management-event-example"></a>

 The following example shows a CloudTrail log entry for the `CreateTracker` operation, which creates a tracker resource. 

```
{
    "eventVersion": "1.05",
    "userIdentity": {
        "type": "AssumedRole",
        "principalId": "111122223333",
        "arn": "arn:aws:geo:us-east-1:111122223333:tracker/ExampleTracker",
        "accountId": "111122223333",
        "accessKeyId": "AKIAIOSFODNN7EXAMPLE",
        "sessionContext": {
            "sessionIssuer": {
                "type": "Role",
                "principalId": "111122223333",
                "arn": "arn:aws:geo:us-east-1:111122223333:tracker/ExampleTracker",
                "accountId": "111122223333",
                "userName": "exampleUser"
            },
            "webIdFederationData": {},
            "attributes": {
                "mfaAuthenticated": "false",
                "creationDate": "2020-10-22T16:36:07Z"
            }
        }
    },
    "eventTime": "2020-10-22T17:43:30Z",
    "eventSource": "geo.amazonaws.com",
    "eventName": "CreateTracker",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "SAMPLE_IP_ADDRESS",
    "userAgent": "aws-internal/3 aws-sdk-java/1.11.864 Linux/4.14.193-110.317.amzn2.x86_64 OpenJDK_64-Bit_Server_VM/11.0.8+10-LTS java/11.0.8 kotlin/1.3.72 vendor/Amazon.com_Inc. exec-env/AWS_Lambda_java11",
    "requestParameters": {
        "TrackerName": "ExampleTracker",
        "Description": "Resource description"
    },
    "responseElements": {
        "TrackerName": "ExampleTracker",
        "Description": "Resource description",
        "TrackerArn": "arn:partition:service:region:account-id:resource-id",
        "CreateTime": "2020-10-22T17:43:30.521Z"
    },
    "requestID": "557ec619-0674-429d-8e2c-eba0d3f34413",
    "eventID": "3192bc9c-3d3d-4976-bbef-ac590fa34f2c",
    "readOnly": false,
    "eventType": "AwsApiCall",
    "recipientAccountId": "111122223333"
}
```

## Example: CloudTrail log file entry for an Amazon Location data event
<a name="cloudtrail-data-event-example"></a>

 The following example shows a CloudTrail log entry for the `Geocode` operation, which retrieves coordinates, addresses, and other details about a place. 

```
{
  "eventVersion": "1.09",
  "userIdentity": {
    "type": "AssumedRole",
    "principalId": "AROA6ODU7M35SFGUCGXHMSAMPLE",
    "arn": "arn:aws:sts::111122223333:assumed-role/Admin/vingu-Isengard",
    "accountId": "111122223333",
    "accessKeyId": "ASIA6ODU7M352GLR5CFMSAMPLE",
    "sessionContext": {
      "sessionIssuer": {
        "type": "Role",
        "principalId": "AROA6ODU7M35SFGUCGXHMSAMPLE",
        "arn": "arn:aws:iam::111122223333:role/Admin",
        "accountId": "111122223333",
        "userName": "Admin"
      },
      "attributes": {
        "creationDate": "2024-09-16T14:41:33Z",
        "mfaAuthenticated": "false"
      }
    }
  },
  "eventTime": "2024-09-16T14:42:16Z",
  "eventSource": "geo-places.amazonaws.com",
  "eventName": "Geocode",
  "awsRegion": "us-west-2",
  "sourceIPAddress": "52.94.133.129",
  "userAgent": "Amazon CloudFront",
  "requestParameters": {
    "Query": "***",
    "Filter": {
      "IncludeCountries": [
        "USA"
      ]
    }
  },
  "responseElements": null,
  "requestID": "1ef7e0b8-c9fc-4a20-80c3-b5340d634c4e",
  "eventID": "913d256c-3a9d-40d0-9bdf-705f12c7659f",
  "readOnly": true,
  "resources": [
    {
      "accountId": "111122223333",
      "type": "AWS::GeoPlaces::Provider",
      "ARN": "arn:aws:geoplaces:us-west-2:111122223333:provider"
    }
  ],
  "eventType": "AwsApiCall",
  "managementEvent": false,
  "recipientAccountId": "111122223333",
  "eventCategory": "Data"
}
```

# Best practices
<a name="integration-best-practice"></a>

The following are a few best practices for integrating with Amazon Location Service.

## Resource management
<a name="resource-best-practice"></a>

To help effectively manage your location resources in Amazon Location Service, consider the following best practices:

**Note**  
The following best practices apply to the standalone resources used with v1 APIs. The v2 Maps, Places, and Routes APIs do not require resource creation.
+ Use regional endpoints that are central to your expected user base to improve their experience. For information about region endpoints, see [Amazon Location supported regions](location-regions.md).
+ For resources that use data providers, such as map resources and place index resources, make sure to follow the terms of use agreement of the specific data provider. For more information, see [Terms of use and data attribution](data-attribution.md).
+ Minimize the creation of resources by having one resource for each configuration of map, place index, or routes. Within a region, you typically need only one resource per data provider or map style. Most applications use existing resources, and do not create resources at run time.
+ When using different resources in a single application, such as a map resource and a route calculator, use the same data provider in each resource to ensure that the data matches. For example, that a route geometry you create with your route calculator aligns with the streets on the map drawn using the map resource.

## Billing and cost management
<a name="cost-best-practice"></a>

To help manage your costs and billing, consider the following best practice:
+ Use monitoring tools, such as Amazon CloudWatch, to track your resource usage. You can set alerts that notify you when usage is about to exceed your specified limits. For more information, see [Creating a Billing Alarm to Monitor Your Estimated AWS Charges](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html) in the *Amazon CloudWatch User Guide*.

## Quotas and usage
<a name="quota-best-practice"></a>

You AWS account includes quotas that set a default limit your usage amount. You can set up alarms to alert you when your usage is getting close to your limit, and you can request a raise to a quota, when you need it. For information about how to work with quotas, see the following topics.
+ [Manage quotas with Service Quotas](manage-quotas.md)
+ [Create CloudWatch alarms for Amazon Location Service metrics](cloudwatch.md#create-alarms)
+ [ Visualizing your service quotas and setting alarms](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Quotas-Visualize-Alarms.html) in the *Amazon CloudWatch User Guide*.

You can create alarms to give you advance warning when you are close to exceeding your limits. We recommend setting alarms for each quota in each AWS Region where you use Amazon Location. For example, you can monitor your use of the `SearchPlaceIndexForText` operation, and create an alarm when you exceed 80 percent of your current quota.

When you get an alarm warning about your quota, you must decide what to do. You might be using additional resources because your customer base has grown. In that case you may want to request an increase to your quota, such as a 50 percent increase in the quota for an API call in that Region. Or, maybe there's an error in your service that causes you to make additional unnecessary calls to Amazon Location. In that case you'd want to solve the problem in your service.