id
stringlengths
8
78
source
stringclasses
743 values
chunk_id
int64
1
5.05k
text
stringlengths
593
49.7k
acw-ug-471
acw-ug.pdf
471
information to the logging message, including the actual logging call. Creating a canary 1754 Amazon CloudWatch User Guide • extra– The third optional keyword argument, which you can use to pass in a dictionary that is used to populate the __dict__ of the LogRecord created for the logging event with user- defined attributes. Example: synthetics_logger.exception('Error encountered trying to publish %s', 'CloudWatch Metric') Python and Selenium library classes and functions that apply to UI canaries only The following CloudWatch Synthetics Selenium library functions for Python are useful only for UI canaries. Topics • SyntheticsBrowser class • SyntheticsWebDriver class SyntheticsBrowser class When you create a browser instance by calling synthetics_webdriver.Chrome(), the returned browser instance is of the type SyntheticsBrowser. The SyntheticsBrowser class controls the ChromeDriver, and enables the canary script to drive the browser, allowing the Selenium WebDriver to work with Synthetics. In addition to the standard Selenium methods, it also provides the following methods. Topics • set_viewport_size(width, height) • save_screenshot(filename, suffix) set_viewport_size(width, height) Sets the viewport of the browser. Example: browser.set_viewport_size(1920, 1080) Creating a canary 1755 Amazon CloudWatch save_screenshot(filename, suffix) User Guide Saves screenshots to the /tmp directory. The screenshots are uploaded from there to the canary artifacts folder in the S3 bucket. filename is the file name for the screenshot, and suffix is an optional string to be used for naming the screenshot. Example: browser.save_screenshot('loaded.png', 'page1') SyntheticsWebDriver class To use this class, use the following in your script: from aws_synthetics.selenium import synthetics_webdriver Topics • add_execution_error(errorMessage, ex); • add_user_agent(user_agent_str) • execute_step(step_name, function_to_execute) • get_http_response(url) • Chrome() add_execution_error(errorMessage, ex); errorMessage describes the error and ex is the exception that is encountered You can use add_execution_error to set execution errors for your canary. It fails the canary without interrupting the script execution. It also doesn't impact your successPercent metrics. You should track errors as execution errors only if they are not important to indicate the success or failure of your canary script. An example of the use of add_execution_error is the following. You are monitoring the availability of your endpoint and taking screenshots after the page has loaded. Because the failure of taking a screenshot doesn't determine availability of the endpoint, you can catch any errors encountered while taking screenshots and add them as execution errors. Your availability metrics Creating a canary 1756 Amazon CloudWatch User Guide will still indicate that the endpoint is up and running, but your canary status will be marked as failed. The following sample code block catches such an error and adds it as an execution error. try: browser.save_screenshot("loaded.png") except Exception as ex: self.add_execution_error("Unable to take screenshot", ex) add_user_agent(user_agent_str) Appends the value of user_agent_str to the browser's user agent header. You must assign user_agent_str before creating the browser instance. Example: synthetics_webdriver.add_user_agent('MyApp-1.0') execute_step(step_name, function_to_execute) Processes one function. It also does the following: • Logs that the step started. • Takes a screenshot named <stepName>-starting. • Starts a timer. • Executes the provided function. • If the function returns normally, it counts as passing. If the function throws, it counts as failing. • Ends the timer. • Logs whether the step passed or failed • Takes a screenshot named <stepName>-succeeded or <stepName>-failed. • Emits the stepName SuccessPercent metric, 100 for pass or 0 for failure. • Emits the stepName Duration metric, with a value based on the step start and end times. • Finally, returns what the functionToExecute returned or re-throws what functionToExecute threw. Example: from selenium.webdriver.common.by import By Creating a canary 1757 Amazon CloudWatch User Guide def custom_actions(): #verify contains browser.find_element(By.XPATH, "//*[@id=\"id_1\"][contains(text(),'login')]") #click a button browser.find_element(By.XPATH, '//*[@id="submit"]/a').click() await synthetics_webdriver.execute_step("verify_click", custom_actions) get_http_response(url) Makes an HTTP request to the provided URL and returns the response code of the HTTP request. If an exception occurred during the HTTP request, a string with value "error" is returned instead. Example: response_code = syn_webdriver.get_http_response(url) if not response_code or response_code == "error" or response_code < 200 or response_code > 299: raise Exception("Failed to load page!") Chrome() Launches an instance of the Chromium browser and returns the created instance of the browser. Example: browser = synthetics_webdriver.Chrome() browser.get("https://example.com/) To launch a browser in incognito mode, use the following: add_argument('——incognito') To add proxy settings, use the following: add_argument('--proxy-server=%s' % PROXY) Example: from selenium.webdriver.chrome.options import Options chrome_options = Options() Creating a canary 1758 Amazon CloudWatch User Guide chrome_options.add_argument("——incognito") browser = syn_webdriver.Chrome(chrome_options=chrome_options) Scheduling canary runs using cron Using a cron expression gives you flexibility when you schedule a canary. Cron expressions contain five or six fields in the order listed in the following table. The fields are separated by spaces. The syntax differs depending on whether you are using the CloudWatch console to create the canary, or the AWS CLI or AWS SDKs. When you use the console, you specify only the first five fields. When you use the AWS CLI or AWS SDKs, you specify all six fields, and you
acw-ug-472
acw-ug.pdf
472
a canary 1758 Amazon CloudWatch User Guide chrome_options.add_argument("——incognito") browser = syn_webdriver.Chrome(chrome_options=chrome_options) Scheduling canary runs using cron Using a cron expression gives you flexibility when you schedule a canary. Cron expressions contain five or six fields in the order listed in the following table. The fields are separated by spaces. The syntax differs depending on whether you are using the CloudWatch console to create the canary, or the AWS CLI or AWS SDKs. When you use the console, you specify only the first five fields. When you use the AWS CLI or AWS SDKs, you specify all six fields, and you must specify * for the Year field. Field Minutes Hours Day-of-month Allowed values Allowed special characters 0-59 0-23 1-31 , - * / , - * / , - * ? / L W Month 1-12 or JAN-DEC , - * / Day-of-week 1-7 or SUN-SAT , - * ? L # Year * Special characters • The , (comma) includes multiple values in the expression for a field. For example, in the Month field, JAN,FEB,MAR would include January, February, and March. • The - (dash) special character specifies ranges. In the Day field, 1-15 would include days 1 through 15 of the specified month. • The * (asterisk) special character includes all values in the field. In the Hours field, * includes every hour. You cannot use * in both the Day-of-month and Day-of-week fields in the same expression. If you use it in one, you must use ? in the other. • The / (forward slash) specifies increments. In the Minutes field, you can enter 1/10 to specify every tenth minute, starting from the first minute of the hour (for example, the eleventh, twenty-first, and thirty-first minute, and so on). Creating a canary 1759 Amazon CloudWatch User Guide • The ? (question mark) specifies one or another. If you enter 7 in the Day-of-month field and you don't care what day of the week the seventh is, you can enter ? in the Day-of-week field. • The L wildcard in the Day-of-month or Day-of-week fields specifies the last day of the month or week. • The W wildcard in the Day-of-month field specifies a weekday. In the Day-of-month field, 3W specifies the weekday closest to the third day of the month. • The # wildcard in the Day-of-week field specifies a certain instance of the specified day of the week within a month. For example, 3#2 is the second Tuesday of the month. The 3 refers to Tuesday because it is the third day of each week, and the 2 refers to the second day of that type within the month. Limitations • You can't specify the Day-of-month and Day-of-week fields in the same cron expression. If you specify a value or * (asterisk) in one of the fields, you must use a ? (question mark) in the other. • Cron expressions that lead to rates faster than one minute are not supported. • You can't set a canary to wait for more than a year before running, so you can specify only * in the Year field. Examples You can refer to the following sample cron strings when you create a canary. The following examples are the correct syntax for using the AWS CLI or AWS SDKs to create or update a canary. If you are using the CloudWatch console, omit the final * in each example. Expression Meaning 0 10 * * ? * Run at 10:00 am (UTC) every day 15 12 * * ? * Run at 12:15 pm (UTC) every day 0 18 ? * MON-FRI * Run at 6:00 pm (UTC) every Monday through Friday 0 8 1 * ? * Run at 8:00 am (UTC) on the first day of each month 0/10 * ? * MON-SAT * Run every 10 minutes Monday through Saturday of each week Creating a canary 1760 Amazon CloudWatch User Guide Expression Meaning 0/5 8-17 ? * MON-FRI * Run every five minutes Monday through Friday between 8:00 am and 5:55 pm (UTC) Groups You can create groups to associate canaries with each other, including cross-Region canaries. Using groups can help you with managing and automating your canaries, and you can also view aggregated run results and statistics for all canaries in a group. Groups are global resources. When you create a group, it is replicated across all AWS Regions that support groups, and you can add canaries from any of these Regions to it, and view it in any of these Regions. Although the group ARN format reflects the Region name where it was created, a group is not constrained to any Region. This means that you can put canaries from multiple Regions into the same group, and then use that group to view and
acw-ug-473
acw-ug.pdf
473
your canaries, and you can also view aggregated run results and statistics for all canaries in a group. Groups are global resources. When you create a group, it is replicated across all AWS Regions that support groups, and you can add canaries from any of these Regions to it, and view it in any of these Regions. Although the group ARN format reflects the Region name where it was created, a group is not constrained to any Region. This means that you can put canaries from multiple Regions into the same group, and then use that group to view and manage all of those canaries in a single view. Groups are supported in all Regions except the Regions that are disabled by default. For more information about these Regions, see Enabling a Region . Each group can contain as many as 10 canaries. You can have as many as 20 groups in your account. Any single canary can be a member of up to 10 groups. To create a group 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Synthetics Canaries. 3. Choose Create Group. 4. Under Group Name, enter a name for the group. 5. Select canaries to associate with this group. To select a canary, type its complete name in Exact canary name and choose Search. Then select the check box next to the canary name. If there are multiple canaries with the same name in different Regions, be sure to select the canaries that you want. You can repeat this step to associate as many as 10 canaries with the group. Groups 1761 Amazon CloudWatch User Guide 6. (Optional) Under Tags, add one or more key-value pairs as tags for this group. Tags can help you identify and organize your AWS resources and track your AWS costs. For more information, see Tagging your Amazon CloudWatch resources. 7. Choose Create Group. Test a canary locally This section explains how to modify, test, and debug CloudWatch Synthetics canaries directly within the Microsoft Visual Studio code editor or the JetBrains IDE code editor. The local debugging environment uses a Serverless Application Model (SAM) container to simulate a Lambda function to emulate the behavior of a Synthetics canary. Note It is impractical to perform locally debug canaries that rely on visual monitoring. Visual monitoring rely on capturing base screenshots during an initial run, and then comparing these screenshots to the screenshots from subsequent runs. In a local development environment, runs are not stored or tracked, and each iteration is an independent, standalone run. The absence of a canary run history makes it impractical to debug canaries that rely on visual monitoring. Prerequisites 1. Choose or create an Amazon S3 bucket to use to store artifacts from local canary test runs, such as HAR files and screenshots. This requires you to be provisioned with IAM. If you skip setting up Amazon S3 buckets you can still test your canary locally, but you will see an error message about the missing bucket and you won't have access to canary artifacts. If you use an Amazon S3 bucket, we recommend that you set the bucket lifecycle to delete objects after a few days, to save costs. For more information, see Managing your storage lifecycle. 2. Set up a default AWS profile for your AWS account. For more information, see Configuration and credential file settings. 3. Set the debug environment's default AWS Region to your preferred Region, such as us-west-2. 4. Install the AWS SAM CLI. For more information, see Installing the AWS SAM CLI. Test a canary locally 1762 Amazon CloudWatch User Guide 5. Install Visual Studio Code Editor or JetBrains IDE. For more information, see Visual Studio Code or JetBrains IDE 6. Install Docker to work with the AWS SAM CLI. Make sure to start the docker daemon. For more information, see Installing Docker to use with the AWS SAM CLI. Alternatively, You can install other container management software such as Rancher, as long as it uses the Docker runtime. 7. Install an AWS toolkit extension for your preferred editor. For more information, see Installing the AWS Toolkit for Visual Studio Code or Installing the AWS Toolkit for JetBrains. Topics • Set up the testing and debugging environment • Use Visual Studio Code IDE • Use JetBrains IDE • Run a canary locally with the SAM CLI • Integrate your local testing environment into an existing canary package • Change the CloudWatch Synthetics runtime • Common errors Set up the testing and debugging environment First, clone the Github repository that AWS provides by entering the following command. The repository contains code samples for both Node.js canaries and Python canaries. git clone https://github.com/aws-samples/synthetics-canary-local-debugging-sample.git Then do one of the following, depending on the language of your canaries. For Node.js
acw-ug-474
acw-ug.pdf
474
for JetBrains. Topics • Set up the testing and debugging environment • Use Visual Studio Code IDE • Use JetBrains IDE • Run a canary locally with the SAM CLI • Integrate your local testing environment into an existing canary package • Change the CloudWatch Synthetics runtime • Common errors Set up the testing and debugging environment First, clone the Github repository that AWS provides by entering the following command. The repository contains code samples for both Node.js canaries and Python canaries. git clone https://github.com/aws-samples/synthetics-canary-local-debugging-sample.git Then do one of the following, depending on the language of your canaries. For Node.js canaries 1. Go to the Node.js canary source directory by entering the following command. cd synthetics-canary-local-debugging-sample/nodejs-canary/src 2. Enter the following command to install canary dependencies. Test a canary locally 1763 Amazon CloudWatch npm install For Python canaries User Guide 1. Go to the Python canary source directory by entering the following command. cd synthetics-canary-local-debugging-sample/python-canary/src 2. Enter the following command to install canary dependencies. pip3 install -r requirements.txt -t . Use Visual Studio Code IDE The Visual Studio launch configuration file is located at .vscode/launch.json. It contains configurations to allow the template file to be discovered by Visual Studio code. It defines a Lambda payload with required parameters to invoke the canary successfully. Here’s the launch configuration for a Node.js canary: { ... ... "lambda": { "payload": { "json": { // Canary name. Provide any name you like. "canaryName": "LocalSyntheticsCanary", // Canary artifact location "artifactS3Location": { "s3Bucket": "cw-syn-results-123456789012-us-west-2", "s3Key": "local-run-artifacts", }, // Your canary handler name "customerCanaryHandlerName": "heartbeat-canary.handler" } }, // Environment variables to pass to the canary code "environmentVariables": {} } Test a canary locally 1764 Amazon CloudWatch } ] } User Guide You can also optionally provide the following fields in the payload JSON: • s3EncryptionMode Valid values: SSE_S3 | SSE_KMS • s3KmsKeyArn Valid value: KMS Key ARN • activeTracing Valid values: true | false • canaryRunId Valid value: UUID This parameter is required if active tracing is enabled. To debug the canary in Visual Studio, add breakpoints in the canary code where you want to pause execution. To add a breakpoint, choose the editor margin and go to Run and Debug mode in the editor. Run the canary by clicking on the play button. When the canary runs, the logs will be tailed in the debug console, providing you with real-time insights into the canary's behavior. If you added breakpoints, the canary execution will pause at each breakpoint, allowing you to step through code and inspect variable values, instance methods, object attributes, and the function call stack. There is no cost incurred for running and debugging canaries locally, except for the artifacts stored in the Amazon S3 bucket and the CloudWatch metrics generated by each local run. Test a canary locally 1765 Amazon CloudWatch User Guide Use JetBrains IDE After you have the AWS Toolkit for JetBrains extension installed, be sure that the Node.js plugin and JavaScript debugger are enabled to run, if you are debugging a Node.js canary. Then follow these steps. Debug a canary using JetBrains IDE 1. 2. In the left navigation pane of JetBrains IDE, choose Lambda, then choose the local configuration template. Enter a name for the run configuration, such as LocalSyntheticsCanary 3. Choose From template, choose the file browser in the template field, then select the template.yml file from the project, either from the nodejs directory or the python directory. 4. In the Input section, enter the payload for the canary as shown in the following screen. { "canaryName": "LocalSyntheticsCanary", "artifactS3Location": { Test a canary locally 1766 Amazon CloudWatch User Guide "s3Bucket": "cw-syn-results-123456789012-us-west-2", "s3Key": "local-run-artifacts" }, "customerCanaryHandlerName": "heartbeat-canary.handler" } You can also set other environment variables in the payload JSON, as listed in Use Visual Studio Code IDE. Run a canary locally with the SAM CLI Use the one of the following procedures to run your canary locally using the Serverless Application Model (SAM) CLI. Be sure to specify your own Amazon S3 bucket name for s3Bucket in event.json Test a canary locally 1767 Amazon CloudWatch User Guide To use the SAM CLI to run a Node.js canary 1. Go to the source directory by entering the following command. cd synthetics-canary-local-debugging-sample/nodejs-canary 2. Enter the following commands. sam build sam local invoke -e ../event.json To use the SAM CLI to run a Python canary 1. Go to the source directory by entering the following command. cd synthetics-canary-local-debugging-sample/python-canary 2. Enter the following commands. sam build sam local invoke -e ../event.json Integrate your local testing environment into an existing canary package You can integrate local canary debugging into your existing canary package by copying three files: • Copy the template.yml file into your canary package root. Be sure to modify the path for CodeUri to point to the directory where your canary code exists. •
acw-ug-475
acw-ug.pdf
475
Enter the following commands. sam build sam local invoke -e ../event.json To use the SAM CLI to run a Python canary 1. Go to the source directory by entering the following command. cd synthetics-canary-local-debugging-sample/python-canary 2. Enter the following commands. sam build sam local invoke -e ../event.json Integrate your local testing environment into an existing canary package You can integrate local canary debugging into your existing canary package by copying three files: • Copy the template.yml file into your canary package root. Be sure to modify the path for CodeUri to point to the directory where your canary code exists. • If you're working with a Node.js canary, copy the cw-synthetics.js file to your canary source directory. If you're working with a Python canary, copy the cw-synthetics.py to your canary source directory. • Copy the launch configuration file .vscode/launch.json into the package root. Make sure to put it inside the .vscode directory; create it if it doesn't exist already. Test a canary locally 1768 Amazon CloudWatch User Guide Change the CloudWatch Synthetics runtime As part of your debugging, you might want to try running a canary with a different CloudWatch Synthetics runtime, instead of the latest runtime. To do so, find the runtime that you want to use from one of the following tables. Be sure to select the runtime for the correct Region. Then paste the ARN for that runtime into the appropriate place in your template.yml file, and then run the canary. Node.js and Puppeteer runtimes ARNs for syn-nodejs-puppeteer-10.0 The following table lists the ARNs to use for version syn-nodejs-puppeteer-10.0 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics:58 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics:61 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics:59 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics:61 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics:59 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics:59 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics:34 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics:41 Test a canary locally 1769 Amazon CloudWatch User Guide Region ARN Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:Synthetics:15 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics:32 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics:59 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics:45 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics:62 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics:63 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics:58 Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:851725245975:la yer:Synthetics:6 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics:59 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics:59 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics:90 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics:58 Test a canary locally 1770 Amazon CloudWatch User Guide Region ARN China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics:59 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics:59 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics:60 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics:58 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics:60 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics:59 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics:34 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics:59 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics:33 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics:31 Mexico (Central) arn:aws:lambda:mx-central-1:654654265476:laye r:Synthetics:7 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics:58 Test a canary locally 1771 Amazon CloudWatch User Guide Region ARN Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics:34 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics:60 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics:54 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics:55 ARNs for syn-nodejs-puppeteer-9.1 The following table lists the ARNs to use for version syn-nodejs-puppeteer-9.1 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics:53 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics:56 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics:54 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics:56 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics:54 Asia Pacific (Hong Kong) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics:54 Test a canary locally 1772 Amazon CloudWatch User Guide Region ARN Asia Pacific (Hyderabad) arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics:29 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics:36 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:Synthetics:10 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics:27 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics:54 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics:40 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics:57 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics:58 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics:53 Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:851725245975:la yer:Synthetics:1 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics:54 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics:54 Test a canary locally 1773 Amazon CloudWatch User Guide Region ARN Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics:85 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics:54 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics:55 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics:54 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics:55 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics:53 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics:55 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics:54 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics:29 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics:54 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics:28 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics:26 Test a canary locally 1774 Amazon CloudWatch User Guide Region ARN Mexico (Central) arn:aws:lambda:mx-central-1:654654265476:laye r:Synthetics:3 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics:53 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics:29 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics:55 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics:50 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics:51 ARNs for syn-nodejs-puppeteer-9.0 The following table lists the ARNs to use for version syn-nodejs-puppeteer-9.0 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics:51 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics:54 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics:52 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics:54 Test a canary locally 1775 Amazon CloudWatch User Guide Region ARN Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics:52 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics:52
acw-ug-476
acw-ug.pdf
476
Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics:29 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics:55 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics:50 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics:51 ARNs for syn-nodejs-puppeteer-9.0 The following table lists the ARNs to use for version syn-nodejs-puppeteer-9.0 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics:51 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics:54 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics:52 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics:54 Test a canary locally 1775 Amazon CloudWatch User Guide Region ARN Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics:52 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics:52 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics:27 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics:34 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:Synthetics:8 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics:25 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics:52 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics:38 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics:55 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics:56 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics:51 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics:52 Test a canary locally 1776 Amazon CloudWatch User Guide Region ARN Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics:52 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics:83 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics:52 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics:53 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics:52 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics:53 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics:51 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics:53 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics:52 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics:27 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics:52 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics:26 Test a canary locally 1777 Amazon CloudWatch User Guide Region ARN Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics:24 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics:51 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics:27 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics:53 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics:48 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics:49 ARNs for syn-nodejs-puppeteer-8.0 The following table lists the ARNs to use for version syn-nodejs-puppeteer-8.0 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics:48 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics:50 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics:48 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics:51 Test a canary locally 1778 Amazon CloudWatch User Guide Region ARN Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics:48 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics:49 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics:24 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics:30 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics:22 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics:48 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics:34 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics:51 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics:53 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics:48 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics:48 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics:48 Test a canary locally 1779 Amazon CloudWatch User Guide Region ARN Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics:80 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics:49 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics:50 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics:48 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics:50 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics:48 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics:49 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics:48 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics:24 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics:48 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics:23 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics:21 Test a canary locally 1780 Amazon CloudWatch User Guide Region ARN Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics:48 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics:23 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics:49 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics:45 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics:46 ARNs for syn-nodejs-puppeteer-7.0 The following table lists the ARNs to use for version syn-nodejs-puppeteer-7.0 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics:44 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics:46 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics:44 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics:47 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics:44 Test a canary locally 1781 Amazon CloudWatch User Guide Region ARN Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics:45 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics:20 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics:26 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:Synthetics:7 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics:18 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics:44 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics:30 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics:46 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics:49 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics:44 Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:851725245975:la yer:Synthetics:3 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics:44 Test a canary locally 1782 Amazon CloudWatch User Guide Region ARN Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics:44 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics:76 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics:45 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics:46 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics:44 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics:46 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics:44 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics:45 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics:44 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics:20 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics:44 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics:19 Test a canary locally 1783 Amazon CloudWatch User Guide Region ARN Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics:17 Mexico (Central) arn:aws:lambda:mx-central-1:654654265476:laye r:Synthetics:4 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics:44 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics:19 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics:45 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics:41 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics:42 ARNs for syn-nodejs-puppeteer-6.2 The following table lists the ARNs to use for version syn-nodejs-puppeteer-6.2 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics:41 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics:43 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics:41 Test a canary locally 1784 Amazon CloudWatch User Guide Region ARN US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics:44 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics:41 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics:42 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics:17 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics:23 Asia Pacific
acw-ug-477
acw-ug.pdf
477
AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics:45 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics:41 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics:42 ARNs for syn-nodejs-puppeteer-6.2 The following table lists the ARNs to use for version syn-nodejs-puppeteer-6.2 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics:41 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics:43 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics:41 Test a canary locally 1784 Amazon CloudWatch User Guide Region ARN US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics:44 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics:41 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics:42 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics:17 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics:23 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics:15 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics:41 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics:27 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics:42 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics:46 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics:41 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics:41 Test a canary locally 1785 Amazon CloudWatch User Guide Region ARN Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics:41 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics:73 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics:42 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics:43 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics:41 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics:43 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics:41 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics:42 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics:41 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics:17 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics:41 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics:16 Test a canary locally 1786 Amazon CloudWatch User Guide Region ARN Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics:14 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics:41 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics:16 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics:42 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics:39 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics:39 ARNs for syn-nodejs-puppeteer-5.2 The following table lists the ARNs to use for version syn-nodejs-puppeteer-5.2 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics:42 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics:44 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics:42 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics:45 Test a canary locally 1787 Amazon CloudWatch User Guide Region ARN Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics:42 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics:43 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics:18 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics:24 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics:16 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics:42 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics:28 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics:44 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics:47 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics:42 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics:42 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics:42 Test a canary locally 1788 Amazon CloudWatch User Guide Region ARN Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics:74 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics:43 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics:44 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics:42 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics:44 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics:42 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics:43 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics:42 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics:18 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics:42 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics:17 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics:15 Test a canary locally 1789 Amazon CloudWatch User Guide Region ARN Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics:42 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics:17 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics:43 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics:40 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics:40 Node.js and Playwright runtimes ARNs for syn-nodejs-playwright-2.0 The following table lists the ARNs to use for version syn-nodejs-playwright-2.0 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 Test a canary locally 1790 Amazon CloudWatch User Guide Region ARN Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 arn:aws:lambda:ap-south-2:280298676434:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:AWS-CW-SyntheticsNodeJsPlaywright:4 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:AWS-CW-SyntheticsNodeJsPlaywright:4 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:AWS-CW-SyntheticsNodeJsPlaywright:4 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:AWS-CW-SyntheticsNodeJsPlaywright:4 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:AWS-CW-SyntheticsNodeJsPlaywright:4 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:AWS-CW-SyntheticsNodeJsPlaywright:4 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:AWS-CW-SyntheticsNodeJsPlaywright:4 Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:851725245975:la yer:AWS-CW-SyntheticsNodeJsPlaywright:3 Test a canary locally 1791 Amazon CloudWatch User Guide Region ARN Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:AWS-CW-SyntheticsNodeJsPlaywright:4 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:AWS-CW-SyntheticsNodeJsPlaywright:4 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:AWS-CW-SyntheticsNodeJsPlaywright:3 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:AWS-CW-SyntheticsNodeJsPlaywright:3 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:AWS-CW-SyntheticsNodeJsPlaywright:4 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 Test a canary locally 1792 Amazon CloudWatch User Guide Region ARN Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:AWS-CW-SyntheticsNodeJsPlaywright:4 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:AWS-CW-SyntheticsNodeJsPlaywright:4 Mexico (Central) arn:aws:lambda:mx-central-1:654654265476:laye r:AWS-CW-SyntheticsNodeJsPlaywright:5 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:AWS-CW-SyntheticsNodeJsPlaywright:4 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:AWS- CW-SyntheticsNodeJsPlaywright:4 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:AWS-CW-SyntheticsNodeJsPlaywright:3 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:AWS-CW-SyntheticsNodeJsPlaywright:3 ARNs for syn-nodejs-playwright-1.0 The following table lists the ARNs to use for version syn-nodejs-playwright-1.0 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Test a canary locally 1793 Amazon CloudWatch User Guide Region ARN US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 arn:aws:lambda:ap-south-2:280298676434:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Asia Pacific
acw-ug-478
acw-ug.pdf
478
arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:AWS-CW-SyntheticsNodeJsPlaywright:3 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:AWS-CW-SyntheticsNodeJsPlaywright:3 ARNs for syn-nodejs-playwright-1.0 The following table lists the ARNs to use for version syn-nodejs-playwright-1.0 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Test a canary locally 1793 Amazon CloudWatch User Guide Region ARN US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 arn:aws:lambda:ap-south-2:280298676434:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Test a canary locally 1794 Amazon CloudWatch User Guide Region ARN Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:851725245975:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:AWS-CW-SyntheticsNodeJsPlaywright:1 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:AWS-CW-SyntheticsNodeJsPlaywright:1 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:AWS-CW-SyntheticsNodeJsPlaywright:1 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:AWS-CW-SyntheticsNodeJsPlaywright:1 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:AWS-CW-SyntheticsNodeJsPlaywright:1 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Test a canary locally 1795 Amazon CloudWatch User Guide Region ARN Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:AWS-CW-SyntheticsNodeJsPlaywright:1 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:AWS-CW-SyntheticsNodeJsPlaywright:1 Mexico (Central) arn:aws:lambda:mx-central-1:654654265476:laye r:AWS-CW-SyntheticsNodeJsPlaywright:3 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:AWS-CW-SyntheticsNodeJsPlaywright:1 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:AWS- CW-SyntheticsNodeJsPlaywright:1 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:AWS-CW-SyntheticsNodeJsPlaywright:1 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:AWS-CW-SyntheticsNodeJsPlaywright:1 Python and Selenium runtimes ARNs for syn-python-selenium-5.1 The following table lists the ARNs to use for version syn-python-selenium-5.1 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Test a canary locally 1796 Amazon CloudWatch User Guide Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics_Selenium:45 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics_Selenium:48 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics_Selenium:46 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics_Selenium:47 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics_Selenium:46 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics_Selenium:45 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics_Selenium:33 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics_Selenium:40 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:Synthetics_Selenium:15 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics_Selenium:31 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics_Selenium:46 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics_Selenium:44 Test a canary locally 1797 Amazon CloudWatch User Guide Region ARN Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics_Selenium:49 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics_Selenium:50 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics_Selenium:45 Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:851725245975:la yer:Synthetics_Selenium:6 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics_Selenium:46 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics_Selenium:44 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics_Selenium:89 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics_Selenium:44 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics_Selenium:44 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics_Selenium:46 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics_Selenium:47 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics_Selenium:45 Test a canary locally 1798 Amazon CloudWatch User Guide Region ARN Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics_Selenium:47 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics_Selenium:46 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics_Selenium:33 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics_Selenium:46 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics_Selenium:32 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics_Selenium:30 Mexico (Central) arn:aws:lambda:mx-central-1:654654265476:laye r:Synthetics_Selenium:7 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics_Selenium:45 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics_Selenium:33 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics_Selenium:47 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics_Selenium:42 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics_Selenium:43 Test a canary locally 1799 Amazon CloudWatch User Guide ARNs for syn-python-selenium-5.0 The following table lists the ARNs to use for version syn-python-selenium-5.0 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics_Selenium:43 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics_Selenium:46 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics_Selenium:44 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics_Selenium:45 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics_Selenium:44 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics_Selenium:43 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics_Selenium:31 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics_Selenium:38 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:Synthetics_Selenium:13 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics_Selenium:29 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics_Selenium:44 Test a canary locally 1800 Amazon CloudWatch User Guide Region ARN Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics_Selenium:42 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics_Selenium:47 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics_Selenium:48 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics_Selenium:43 Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:851725245975:la yer:Synthetics_Selenium:4 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics_Selenium:44 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics_Selenium:44 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics_Selenium:87 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics_Selenium:43 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics_Selenium:43 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics_Selenium:44 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics_Selenium:45 Test a canary locally 1801 Amazon CloudWatch User Guide Region ARN Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics_Selenium:43 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics_Selenium:45 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics_Selenium:44 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics_Selenium:31 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics_Selenium:44 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics_Selenium:30 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics_Selenium:28 Mexico (Central) arn:aws:lambda:mx-central-1:654654265476:laye r:Synthetics_Selenium:5 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics_Selenium:43 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics_Selenium:31 South America (São Paulo) AWS GovCloud (US- East) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics_Selenium:45 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics_Selenium:41 Test a canary locally 1802 Amazon CloudWatch User Guide Region ARN AWS GovCloud (US- West) arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics_Selenium:42 ARNs for syn-python-selenium-4.1 The following table lists the ARNs to use for version syn-python-selenium-4.1 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics_Selenium:40 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics_Selenium:43 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics_Selenium:41 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics_Selenium:42 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics_Selenium:41 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics_Selenium:40 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics_Selenium:28 Asia Pacific (Jakarta)
acw-ug-479
acw-ug.pdf
479
South America (São Paulo) AWS GovCloud (US- East) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics_Selenium:45 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics_Selenium:41 Test a canary locally 1802 Amazon CloudWatch User Guide Region ARN AWS GovCloud (US- West) arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics_Selenium:42 ARNs for syn-python-selenium-4.1 The following table lists the ARNs to use for version syn-python-selenium-4.1 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics_Selenium:40 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics_Selenium:43 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics_Selenium:41 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics_Selenium:42 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics_Selenium:41 Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics_Selenium:40 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics_Selenium:28 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics_Selenium:35 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:Synthetics_Selenium:10 Test a canary locally 1803 Amazon CloudWatch User Guide Region ARN Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics_Selenium:26 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics_Selenium:41 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics_Selenium:39 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics_Selenium:44 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics_Selenium:45 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics_Selenium:40 Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:851725245975:la yer:Synthetics_Selenium:1 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics_Selenium:41 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics_Selenium:41 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics_Selenium:84 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics_Selenium:40 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics_Selenium:40 Test a canary locally 1804 Amazon CloudWatch User Guide Region ARN Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics_Selenium:41 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics_Selenium:42 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics_Selenium:40 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics_Selenium:42 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics_Selenium:41 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics_Selenium:28 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics_Selenium:41 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics_Selenium:27 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics_Selenium:25 Mexico (Central) arn:aws:lambda:mx-central-1:654654265476:laye r:Synthetics_Selenium:3 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics_Selenium:40 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics_Selenium:28 Test a canary locally 1805 Amazon CloudWatch User Guide Region ARN South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics_Selenium:42 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics_Selenium:38 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics_Selenium:39 ARNs for syn-python-selenium-4.0 The following table lists the ARNs to use for version syn-python-selenium-4.0 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics_Selenium:38 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics_Selenium:41 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics_Selenium:39 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics_Selenium:40 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics_Selenium:39 Asia Pacific (Hong Kong) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics_Selenium:38 Asia Pacific (Hyderabad) Test a canary locally arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics_Selenium:26 1806 Amazon CloudWatch User Guide Region ARN Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics_Selenium:33 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:Synthetics_Selenium:8 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics_Selenium:24 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics_Selenium:39 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics_Selenium:37 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics_Selenium:42 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics_Selenium:43 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics_Selenium:38 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics_Selenium:39 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics_Selenium:39 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics_Selenium:82 China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics_Selenium:38 Test a canary locally 1807 Amazon CloudWatch User Guide Region ARN China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics_Selenium:38 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics_Selenium:39 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics_Selenium:40 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics_Selenium:38 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics_Selenium:40 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics_Selenium:39 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics_Selenium:26 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics_Selenium:39 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics_Selenium:25 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics_Selenium:23 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics_Selenium:38 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics_Selenium:26 Test a canary locally 1808 Amazon CloudWatch User Guide Region ARN South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics_Selenium:40 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics_Selenium:36 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics_Selenium:37 ARNs for syn-python-selenium-3.0 The following table lists the ARNs to use for version syn-python-selenium-3.0 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics_Selenium:32 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics_Selenium:34 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics_Selenium:32 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics_Selenium:34 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics_Selenium:32 Asia Pacific (Hong Kong) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics_Selenium:32 Asia Pacific (Hyderabad) Test a canary locally arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics_Selenium:20 1809 Amazon CloudWatch User Guide Region ARN Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics_Selenium:26 Asia Pacific (Malaysia) arn:aws:lambda:ap-southeast-5:035872523913:la yer:Synthetics_Selenium:7 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics_Selenium:18 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics_Selenium:32 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics_Selenium:30 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics_Selenium:34 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics_Selenium:37 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics_Selenium:32 Asia Pacific (Thailand) arn:aws:lambda:ap-southeast-7:851725245975:la yer:Synthetics_Selenium:3 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics_Selenium:32 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics_Selenium:32 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics_Selenium:76 Test a canary locally 1810 Amazon CloudWatch User Guide Region ARN China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics_Selenium:32 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics_Selenium:32 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics_Selenium:32 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics_Selenium:34 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics_Selenium:32 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics_Selenium:33 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics_Selenium:32 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics_Selenium:20 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics_Selenium:32 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics_Selenium:19 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics_Selenium:17 Mexico (Central) arn:aws:lambda:mx-central-1:654654265476:laye r:Synthetics_Selenium:4 Test a canary locally 1811 Amazon CloudWatch User Guide Region ARN Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics_Selenium:32 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics_Selenium:19 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics_Selenium:33 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics_Selenium:30 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics_Selenium:31 ARNs for syn-python-selenium-2.1 The following table lists the ARNs to use for version syn-python-selenium-2.1 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics:29 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics:31 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics:29 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics:31 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics:29 Test a canary locally 1812 Amazon CloudWatch User Guide
acw-ug-480
acw-ug.pdf
480
Amazon CloudWatch User Guide Region ARN Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics_Selenium:32 Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics_Selenium:19 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics_Selenium:33 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics_Selenium:30 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics_Selenium:31 ARNs for syn-python-selenium-2.1 The following table lists the ARNs to use for version syn-python-selenium-2.1 of the CloudWatch Synthetics runtime in each AWS Region where it is available. Region ARN US East (N. Virginia) arn:aws:lambda:us-east-1:378653112637:layer:S ynthetics:29 US East (Ohio) arn:aws:lambda:us-east-2:772927465453:layer:S ynthetics:31 US West (N. Californi a) arn:aws:lambda:us-west-1:332033056316:layer:S ynthetics:29 US West (Oregon) arn:aws:lambda:us-west-2:760325925879:layer:S ynthetics:31 Africa (Cape Town) arn:aws:lambda:af-south-1:461844272066:layer: Synthetics:29 Test a canary locally 1812 Amazon CloudWatch User Guide Region ARN Asia Pacific (Hong Kong) Asia Pacific (Hyderabad) arn:aws:lambda:ap-east-1:129828061636:layer:S ynthetics:29 arn:aws:lambda:ap-south-2:280298676434:layer: Synthetics:17 Asia Pacific (Jakarta) arn:aws:lambda:ap-southeast-3:246953257743:la yer:Synthetics:23 Asia Pacific (Melbourne) arn:aws:lambda:ap-southeast-4:200724813040:la yer:Synthetics:15 Asia Pacific (Mumbai) arn:aws:lambda:ap-south-1:724929286329:layer: Synthetics:29 Asia Pacific (Osaka) arn:aws:lambda:ap-northeast-3:608016332111:la yer:Synthetics:27 Asia Pacific (Seoul) arn:aws:lambda:ap-northeast-2:989515803484:la yer:Synthetics:30 Asia Pacific (Singapor e) arn:aws:lambda:ap-southeast-1:068035103298:la yer:Synthetics:34 Asia Pacific (Sydney) arn:aws:lambda:ap-southeast-2:584677157514:la yer:Synthetics:29 Asia Pacific (Tokyo) arn:aws:lambda:ap-northeast-1:172291836251:la yer:Synthetics:29 Canada (Central) arn:aws:lambda:ca-central-1:236629016841:laye r:Synthetics:29 Canada West (Calgary) arn:aws:lambda:ca-west-1:944448206667:layer:S ynthetics:73 Test a canary locally 1813 Amazon CloudWatch User Guide Region ARN China (Beijing) arn:aws-cn:lambda:cn-north-1:422629156088:lay er:Synthetics:29 China (Ningxia); arn:aws-cn:lambda:cn-northwest-1:474974519687 :layer:Synthetics:29 Europe (Frankfurt) arn:aws:lambda:eu-central-1:122305336817:laye r:Synthetics:29 Europe (Ireland) arn:aws:lambda:eu-west-1:563204233543:layer:S ynthetics:31 Europe (London) arn:aws:lambda:eu-west-2:565831452869:layer:S ynthetics:29 Europe (Milan) arn:aws:lambda:eu-south-1:525618516618:layer: Synthetics:30 Europe (Paris) arn:aws:lambda:eu-west-3:469466506258:layer:S ynthetics:29 Europe (Spain) arn:aws:lambda:eu-south-2:029793053121:layer: Synthetics:17 Europe (Stockholm) arn:aws:lambda:eu-north-1:162938142733:layer: Synthetics:29 Europe (Zurich) arn:aws:lambda:eu-central-2:224218992030:laye r:Synthetics:16 Israel (Tel Aviv) arn:aws:lambda:il-central-1:313249807427:laye r:Synthetics:14 Middle East (Bahrain) arn:aws:lambda:me-south-1:823195537320:layer: Synthetics:29 Test a canary locally 1814 Amazon CloudWatch User Guide Region ARN Middle East (UAE) arn:aws:lambda:me-central-1:239544149032:laye r:Synthetics:16 arn:aws:lambda:sa-east-1:783765544751:layer:S ynthetics:30 arn:aws-us-gov:lambda:us-gov-east-1:946759330 430:layer:Synthetics:29 arn:aws-us-gov:lambda:us-gov-west-1:946807836 238:layer:Synthetics:29 South America (São Paulo) AWS GovCloud (US- East) AWS GovCloud (US- West) Common errors Error: Running AWS SAM projects locally requires Docker. Have you got it installed and running? Make sure to start Docker on your computer. SAM local invoke failed: An error occurred (ExpiredTokenException) when calling the GetLayerVersion operation: The security token included in the request is expired Make sure that the AWS default profile is set up. More common errors For more information about common errors with the SAM, see AWS SAM CLI troubleshooting . Troubleshooting a failed canary If your canary fails, check the following for troubleshooting. General troubleshooting • Use the canary details page to find more information. In the CloudWatch console, choose Canaries in the navigation pane and then choose the name of the canary to open the canary details page. In the Availability tab, check the SuccessPercent metric to see whether the problem is constant or intermittent. Troubleshooting a failed canary 1815 Amazon CloudWatch User Guide While still in the Availability tab, choose a failed data point to see screenshots, logs, and step reports (if available) for that failed run. If a step report is available because steps are part of your script, check to see which step has failed and see the associated screenshots to see the issue that your customers are seeing. You can also check the HAR files to see if one or more requests are failing. You can dig deeper by using logs to drill down on failed requests and errors. Finally, you can compare these artifacts with the artifacts from a successful canary run to pinpoint the issue. By default, CloudWatch Synthetics captures screenshots for each step in a UI canary. However, your script might be configured to disable screenshots. During debugging, you may want to enable screenshots again. Similarly, for API canaries you might want to see HTTP request and response headers and body during debugging. For information about how to include this data in the report, see executeHttpStep(stepName, requestOptions, [callback], [stepConfig]). • If you had a recent deployment to your application, roll it back and then debug later. • Connect to your endpoint manually to see if you can reproduce the same issue. Topics • Canary fails after Lambda environment update • My canary is blocked by AWS WAF • Waiting for an element to appear • Node is either not visible or not an HTMLElement for page.click() • Unable to upload artifacts to S3, Exception: Unable to fetch S3 bucket location: Access Denied • Error: Protocol error (Runtime.callFunctionOn): Target closed. • Canary Failed. Error: No datapoint - Canary Shows timeout error • Trying to access an internal endpoint • Canary runtime version upgrade and downgrade issues • Cross-origin request sharing (CORS) issue • Canary race condition issues • Troubleshooting a canary on a VPC Troubleshooting a failed canary 1816 Amazon CloudWatch User Guide Canary fails after Lambda environment update CloudWatch Synthetics canaries are implemented as Lambda functions in your account. These Lambda functions are subject to regular Lambda runtime updates containing security updates, bug fixes, and other improvements. Lambda strives to provide runtime updates that are backward- compatible with existing functions. However, as with software patching, there are rare cases in which a runtime update can negatively impact an existing function. If you believe your canary has been impacted by
acw-ug-481
acw-ug.pdf
481
(CORS) issue • Canary race condition issues • Troubleshooting a canary on a VPC Troubleshooting a failed canary 1816 Amazon CloudWatch User Guide Canary fails after Lambda environment update CloudWatch Synthetics canaries are implemented as Lambda functions in your account. These Lambda functions are subject to regular Lambda runtime updates containing security updates, bug fixes, and other improvements. Lambda strives to provide runtime updates that are backward- compatible with existing functions. However, as with software patching, there are rare cases in which a runtime update can negatively impact an existing function. If you believe your canary has been impacted by a Lambda runtime update, you can use the Lambda runtime management manual mode (in supported Regions) to temporarily roll back the Lambda runtime version. This keeps your canary function working and minimizes disruption, providing time to remedy the incompatibility before returning to the latest runtime version. If your canary is failing after a Lambda runtime update, the best solution is to upgrade to one of the newest Synthetics runtimes. For more information about the latest runtimes, see Synthetics runtime versions. As an alternative solution, in Regions where Lambda runtime management controls are available, you can revert a canary back to an older Lambda managed runtime, using manual mode for runtime management controls. You can set manual mode using either the AWS CLI or by using the Lambda console, using the steps below in the following sections. Warning When you change the runtime settings to manual mode, your Lambda function won't receive automatic security updates until it is reverted back to Auto mode. During this period, your Lambda function might be susceptible to security vulnerabilities. Prerequisites • Install jq • Install the latest version of the AWS CLI. For more information, see AWS CLI install and update instructions . Step 1: Obtain the Lambda function ARN Run the following command to retrieve the EngineArn field from the response. This EngineArn is the ARN of the Lambda function that is associated with the canary. You will use this ARN in the following steps. Troubleshooting a failed canary 1817 Amazon CloudWatch User Guide aws synthetics get-canary --name my-canary | jq '.Canary.EngineArn' Example output of EngingArn: "arn:aws:lambda:us-west-2:123456789012:function:cwsyn-my-canary-dc5015c2-db17-4cb5- afb1-EXAMPLE991:8" Step 2: Obtain the last good Lambda runtime version ARN To help understand whether your canary was impacted by a Lambda runtime update, check whether the date and time when the Lambda runtime version ARN changes in your logs appeared to the date and time when you saw impact to your canary. If they do not match, it is probably not a Lambda runtime update that is causing your issues. If your canary is impacted by a Lambda runtime update, you must identify the ARN of the working Lambda runtime version that you were previously using. Follow the instructions in Identifying runtime version changes to find the ARN of the previous runtime. Record the runtime version ARN, and continue to Step 3. for setting the runtime management configuration. If your canary has not yet been impacted by a Lambda environment update, then you can find the ARN of the Lambda runtime version that you are currently using. Run the following command to retrieve the RuntimeVersionArn of the Lambda function from the response. aws lambda get-function-configuration \ --function-name "arn:aws:lambda:us-west-2:123456789012:function:cwsyn-my-canary- dc5015c2-db17-4cb5-afb1-EXAMPLE991:8" | jq '.RuntimeVersionConfig.RuntimeVersionArn' Example output of RuntimeVersionArn: "arn:aws:lambda:us- west-2::runtime:EXAMPLE647b82f490a45d7ddd96b557b916a30128d9dcab5f4972911ec0f" Step 3: Updating the Lambda runtime management configuration You can use either the AWS CLI or the Lambda console to update the runtime management configuration. To set Lambda runtime management configuration manual mode using the AWS CLI Troubleshooting a failed canary 1818 Amazon CloudWatch User Guide Enter the following command to change the runtime management of the Lambda function to manual mode. Be sure to replace the function-name and qualifier with the Lambda function ARN and Lambda function version number respectively, using the values you found in Step 1. Also replace the the runtime-version-arn with the version ARN that you found in Step 2. aws lambda put-runtime-management-config \ --function-name "arn:aws:lambda:us-west-2:123456789012:function:cwsyn-my-canary- dc5015c2-db17-4cb5-afb1-EXAMPLE991" \ --qualifier 8 \ --update-runtime-on "Manual" \ --runtime-version-arn "arn:aws:lambda:us- west-2::runtime:a993d90ea43647b82f490a45d7ddd96b557b916a30128d9dcab5f4972911ec0f" To change a canary to manual mode using the Lambda console 1. Open the AWS Lambda console at https://console.aws.amazon.com/lambda/. 2. Choose the Versions tab, choose the version number link that corresponds to your ARN, and choose the Code tab. 3. Scroll down to Runtime settings, expand Runtime management configuration, and copy the the Runtime version ARN. 4. Choose Edit runtime management configuration, choose Manual, paste the runtime version ARN that you copied earlier into the Runtime version ARN field. Then choose Save. Troubleshooting a failed canary 1819 Amazon CloudWatch User Guide My canary is blocked by AWS WAF To allow canary traffic through AWS WAF,create a AWS WAF string match condition that allows a custom string that you specify. For more information, see Working with string match
acw-ug-482
acw-ug.pdf
482
number link that corresponds to your ARN, and choose the Code tab. 3. Scroll down to Runtime settings, expand Runtime management configuration, and copy the the Runtime version ARN. 4. Choose Edit runtime management configuration, choose Manual, paste the runtime version ARN that you copied earlier into the Runtime version ARN field. Then choose Save. Troubleshooting a failed canary 1819 Amazon CloudWatch User Guide My canary is blocked by AWS WAF To allow canary traffic through AWS WAF,create a AWS WAF string match condition that allows a custom string that you specify. For more information, see Working with string match conditions in the AWS WAF documentation. We strongly recommend that you use your own custom user-agent string instead of using default values. This provides better control over AWS WAF filtering and improves security. To set a custom user-agent string, do the following: • For Playwright runtimes, you can append your AWS WAF approved custom user-agent string using the Synthetics configuration file. For more information, see CloudWatch Synthetics configurations. • For Puppeteer or Selenium runtimes, you can add your custom user-agent string using supported library functions. For Puppeteer runtimes, see async addUserAgent(page, userAgentString);. For Selenium runtimes, see add_user_agent(user_agent_str). Troubleshooting a failed canary 1820 Amazon CloudWatch User Guide Waiting for an element to appear After analyzing your logs and screenshots, if you see that your script is waiting for an element to appear on screen and times out, check the relevant screenshot to see if the element appears on the page. Verify your xpath to make sure that it is correct. For Puppetteer-related issues, check Puppeteer's GitHub page or internet forums. Node is either not visible or not an HTMLElement for page.click() If a node is not visible or is not an HTMLElement for page.click(), first verify the xpath that you are using to click the element. Also, if your element is at the bottom of the screen, adjust your viewport. CloudWatch Synthetics by default uses a viewport of 1920 * 1080. You can set a different viewport when you launch the browser or by using the Puppeteer function page.setViewport. Unable to upload artifacts to S3, Exception: Unable to fetch S3 bucket location: Access Denied If your canary fails because of an Amazon S3 error, CloudWatch Synthetics was unable to upload screenshots, logs, or reports created for the canary because of permission issues. Check the following: • Check that the canary's IAM role has the s3:ListAllMyBuckets permission, the s3:GetBucketLocation permission for the correct Amazon S3 bucket, and the s3:PutObject permission for the bucket where the canary stores its artifacts. If the canary performs visual monitoring, the role also needs the s3:GetObject permission for the bucket. These same permissions are also required in the Amazon VPC S3 Gateway Endpoint Policy, if the canary is deployed in a VPC with a VPC endpoint. • If the canary uses an AWS KMS customer managed key for encryption instead of the standard AWS managed key (default), the canary's IAM role might not have the permission to encrypt or decrypt using that key. For more information, see Encrypting canary artifacts. • Your bucket policy might not allow the encryption mechanism that the canary uses. For example, if your bucket policy mandates to use a specific encryption mechanism or KMS key, then you must select the same encryption mode for your canary. If the canary performs visual monitoring, see Updating artifact location and encryption when using visual monitoring for more information. Troubleshooting a failed canary 1821 Amazon CloudWatch User Guide Error: Protocol error (Runtime.callFunctionOn): Target closed. This error appears if there are some network requests after the page or browser is closed. You might have forgotten to wait for an asynchronous operation. After executing your script, CloudWatch Synthetics closes the browser. The execution of any asynchronous operation after the browser is closed might cause target closed error. Canary Failed. Error: No datapoint - Canary Shows timeout error This means that your canary run exceeded the timeout. The canary execution stopped before CloudWatch Synthetics could publish success percent CloudWatch metrics or update artifacts such as HAR files, logs and screenshots. If your timeout is too low, you can increase it. By default, a canary timeout value is equal to its frequency. You can manually adjust the timeout value to be less than or equal to the canary frequency. If your canary frequency is low, you must increase the frequency to increase the timeout. You can adjust both the frequency and the timeout value under Schedule when you create or update a canary by using the CloudWatch Synthetics console. Be sure that your canary timeout value is no shorter than 15 seconds to allow for Lambda cold starts and the time it takes to boot up the canary instrumentation. Canary artifacts are not available to view in the CloudWatch Synthetics
acw-ug-483
acw-ug.pdf
483
its frequency. You can manually adjust the timeout value to be less than or equal to the canary frequency. If your canary frequency is low, you must increase the frequency to increase the timeout. You can adjust both the frequency and the timeout value under Schedule when you create or update a canary by using the CloudWatch Synthetics console. Be sure that your canary timeout value is no shorter than 15 seconds to allow for Lambda cold starts and the time it takes to boot up the canary instrumentation. Canary artifacts are not available to view in the CloudWatch Synthetics console when this error happens. You can use CloudWatch Logs to see the canary's logs. To use CloudWatch Logs to see the logs for a canary 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the left navigation pane, choose Log groups. Find the log group by typing the canary name in the filter box. Log groups for canaries have the name /aws/lambda/cwsyn-canaryName-randomId. Trying to access an internal endpoint If you want your canary to access an endpoint on your internal network, we recommend that you set up CloudWatch Synthetics to use VPC. For more information, see Running a canary on a VPC. Troubleshooting a failed canary 1822 Amazon CloudWatch User Guide Canary runtime version upgrade and downgrade issues If you recently upgraded the canary from runtime version syn-1.0 to a later version, it may be a cross-origin request sharing (CORS) issue. For more information, see Cross-origin request sharing (CORS) issue. If you recently downgraded the canary to an older runtime version, check to make sure that the CloudWatch Synthetics functions that you are using are available in the older runtime version that you downgraded to. For example, the executeHttpStep function is available for runtime version syn-nodejs-2.2 and later. To check on the availability of functions, see Writing a canary script. Note When you plan to upgrade or downgrade the runtime version for a canary, we recommend that you first clone the canary and update the runtime version in the cloned canary. Once you have verified that the clone with the new runtime version works, you can update the runtime version of your original canary and delete the clone. Cross-origin request sharing (CORS) issue In a UI canary, if some network requests are failing with 403 or net::ERR_FAILED, check whether the canary has active tracing enabled and also uses the Puppeteer function page.setExtraHTTPHeaders to add headers. If so, the failed network requests might be caused by cross-origin request sharing (CORS) restrictions. You can confirm whether this is the case by disabling active tracing or removing the extra HTTP headers. Why does this happen? When active tracing is used, an extra header is added to all outgoing requests to trace the call. Modifying the request headers by adding a trace header or adding extra headers using Puppeteer’s page.setExtraHTTPHeaders causes a CORS check for XMLHttpRequest (XHR) requests. If you don't want to disable active tracing or remove the extra headers, you can update your web application to allow cross-origin access or you can disable web security by using the disable- web-security flag when you launch the Chrome browser in your script. You can override launch parameters used by CloudWatch Synthetics and pass additional disable- web-security flag parameters by using the CloudWatch Synthetics launch function. For more information, see Library functions available for Node.js canary scripts using Puppeteer. Troubleshooting a failed canary 1823 Amazon CloudWatch Note User Guide You can override launch parameters used by CloudWatch Synthetics when you use runtime version syn-nodejs-2.1 or later. Canary race condition issues For the best experience when using CloudWatch Synthetics, ensure that the code written for the canaries is idempotent. Otherwise, in rare cases, canary runs may encounter race conditions when the canary interacts with the same resource across different runs. Troubleshooting a canary on a VPC If you have issues after creating or updating a canary on a VPC, one of the following sections might help you troubleshoot the problem. New canary in error state or canary can't be updated If you create a canary to run on a VPC and it immediately goes into an error state, or you can't update a canary to run on a VPC, the canary's role might not have the right permissions. To run on a VPC, a canary must have the permissions ec2:CreateNetworkInterface, ec2:DescribeNetworkInterfaces, and ec2:DeleteNetworkInterface. These permissions are all contained in the AWSLambdaVPCAccessExecutionRole managed policy. For more information, see Execution Role and User Permissions. If this issue happened when you created a canary, you must delete the canary, and create a new one. If you use the CloudWatch console to create the new canary, under Access Permissions, select Create a new role. A new role that includes all permissions required to run the canary is created.
acw-ug-484
acw-ug.pdf
484
to run on a VPC, the canary's role might not have the right permissions. To run on a VPC, a canary must have the permissions ec2:CreateNetworkInterface, ec2:DescribeNetworkInterfaces, and ec2:DeleteNetworkInterface. These permissions are all contained in the AWSLambdaVPCAccessExecutionRole managed policy. For more information, see Execution Role and User Permissions. If this issue happened when you created a canary, you must delete the canary, and create a new one. If you use the CloudWatch console to create the new canary, under Access Permissions, select Create a new role. A new role that includes all permissions required to run the canary is created. If this issue happens when you update a canary, you can update the canary again and provide a new role that has the required permissions. "No test result returned" error If a canary displays a "no test result returned" error, one of the following issues might be the cause: • If your VPC does not have internet access, you must use VPC endpoints to give the canary access to CloudWatch and Amazon S3. You must enable the DNS resolution and DNS hostname options in the VPC for these endpoint addresses to resolve correctly. For more information, see Troubleshooting a failed canary 1824 Amazon CloudWatch User Guide Using DNS with Your VPC and Using CloudWatch and CloudWatch Synthetics with interface VPC endpoints . • Canaries must run in private subnets within a VPC. To check this, open the Subnets page in the VPC console. Check the subnets that you selected when configuring the canary. If they have a path to an internet gateway (igw-), they are not private subnets. To help you troubleshoot these issues, see the logs for the canary. To see the log events from a canary 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Log groups. 3. Choose the name of the canary's log group. The log group name starts with /aws/lambda/ cwsyn-canary-name. Sample code for canary scripts This section contains code samples that illustrate some possible functions for CloudWatch Synthetics canary scripts. Samples for Node.js and Playwright Playwright canary with multiple steps The following script is an example of a Node.js Playwright canary with multiple steps. import { synthetics } from '@amzn/synthetics-playwright'; export async function handler(event, context) { try { console.log('Running Synthetics Playwright canary'); const browser = await synthetics.launch(); const browserContext = await browser.newContext(); const page = await synthetics.getPage(browserContext); // Add steps // Step 1 await synthetics.executeStep("home-page", async () => { console.log("Verify home page loads") Sample code for canary scripts 1825 Amazon CloudWatch User Guide await page.goto('https://www.amazon.com', {waitUntil: "load"}); await new Promise(r => setTimeout(r, 5000)); }); // Step 2 await synthetics.executeStep("search", async () => { console.log("Searching for a product") const searchInput = page.getByPlaceholder("Search Amazon").first(); await searchInput.click() await searchInput.fill('Amazon echo'); const btn = page.getByRole('button', { name: 'Go' }).first() await btn.click({ timeout: 15000 }) console.log("Clicked search button") }); // Step 3 await synthetics.executeStep("search-results", async () => { console.log("Verifying search results") const resultsHeading = page.getByText("Results", {exact: true}).first() await resultsHeading.highlight(); await new Promise(r => setTimeout(r, 5000)); }); } finally { // Close all browser contexts and browser await synthetics.close(); } } Playwright canaries setting cookies The following script is an example of a Node.js Playwright canary setting three cookies. import { synthetics } from '@amzn/synthetics-playwright'; export const handler = async (event, context) => { try { let url = "http://smile.amazon.com/"; const browser = await synthetics.launch(); const page = await synthetics.getPage(browser); const cookies = [{ 'name': 'cookie1', 'value': 'val1', 'url': url Sample code for canary scripts 1826 User Guide Amazon CloudWatch }, { 'name': 'cookie2', 'value': 'val2', 'url': url }, { 'name': 'cookie3', 'value': 'val3', 'url': url } ]; await page.context().addCookies(cookies); await page.goto(url, {waitUntil: 'load', timeout: 30000}); await page.screenshot({ path: '/tmp/smile.png' }); } finally { await synthetics.close(); } }; Samples for Node.js and Puppeteer Setting cookies Web sites rely on cookies to provide custom functionality or track users. By setting cookies in CloudWatch Synthetics scripts, you can mimic this custom behavior and validate it. For example, a web site might display a Login link for a revisiting user instead of a Register link. var synthetics = require('Synthetics'); const log = require('SyntheticsLogger'); const pageLoadBlueprint = async function () { let url = "http://smile.amazon.com/"; let page = await synthetics.getPage(); // Set cookies. I found that name, value, and either url or domain are required fields. const cookies = [{ 'name': 'cookie1', Sample code for canary scripts 1827 Amazon CloudWatch User Guide 'value': 'val1', 'url': url },{ 'name': 'cookie2', 'value': 'val2', 'url': url },{ 'name': 'cookie3', 'value': 'val3', 'url': url }]; await page.setCookie(...cookies); // Navigate to the url await synthetics.executeStep('pageLoaded_home', async function (timeoutInMillis = 30000) { var response = await page.goto(url, {waitUntil: ['load', 'networkidle0'], timeout: timeoutInMillis}); // Log cookies for this page and this url const cookiesSet = await page.cookies(url); log.info("Cookies for url: " + url + " are set
acw-ug-485
acw-ug.pdf
485
// Set cookies. I found that name, value, and either url or domain are required fields. const cookies = [{ 'name': 'cookie1', Sample code for canary scripts 1827 Amazon CloudWatch User Guide 'value': 'val1', 'url': url },{ 'name': 'cookie2', 'value': 'val2', 'url': url },{ 'name': 'cookie3', 'value': 'val3', 'url': url }]; await page.setCookie(...cookies); // Navigate to the url await synthetics.executeStep('pageLoaded_home', async function (timeoutInMillis = 30000) { var response = await page.goto(url, {waitUntil: ['load', 'networkidle0'], timeout: timeoutInMillis}); // Log cookies for this page and this url const cookiesSet = await page.cookies(url); log.info("Cookies for url: " + url + " are set to: " + JSON.stringify(cookiesSet)); }); }; exports.handler = async () => { return await pageLoadBlueprint(); }; Device emulation You can write scripts that emulate various devices so that you can approximate how a page looks and behaves on those devices. The following sample emulates an iPhone 6 device. For more information about emulation, see page.emulate(options) in the Puppeteer documentation. var synthetics = require('Synthetics'); const log = require('SyntheticsLogger'); Sample code for canary scripts 1828 Amazon CloudWatch User Guide const puppeteer = require('puppeteer-core'); const pageLoadBlueprint = async function () { const iPhone = puppeteer.devices['iPhone 6']; // INSERT URL here const URL = "https://amazon.com"; let page = await synthetics.getPage(); await page.emulate(iPhone); //You can customize the wait condition here. For instance, //using 'networkidle2' may be less restrictive. const response = await page.goto(URL, {waitUntil: 'domcontentloaded', timeout: 30000}); if (!response) { throw "Failed to load page!"; } await page.waitFor(15000); await synthetics.takeScreenshot('loaded', 'loaded'); //If the response status code is not a 2xx success code if (response.status() < 200 || response.status() > 299) { throw "Failed to load page!"; } }; exports.handler = async () => { return await pageLoadBlueprint(); }; Multi-step API canary This sample code demonstrates an API canary with two HTTP steps: testing the same API for positive and negative test cases. The step configuration is passed to enable reporting of request/ response headers. Additionally, it hides the Authorization header and X-Amz-Security-Token, because they contain user credentials. Sample code for canary scripts 1829 Amazon CloudWatch User Guide When this script is used as a canary, you can view details about each step and the associated HTTP requests such as step pass/fail, duration, and performance metrics like DNS look up time and first byte time. You can view the number of 2xx, 4xx and 5xx for your canary run. var synthetics = require('Synthetics'); const log = require('SyntheticsLogger'); const apiCanaryBlueprint = async function () { // Handle validation for positive scenario const validatePositiveCase = async function(res) { return new Promise((resolve, reject) => { if (res.statusCode < 200 || res.statusCode > 299) { throw res.statusCode + ' ' + res.statusMessage; } let responseBody = ''; res.on('data', (d) => { responseBody += d; }); res.on('end', () => { // Add validation on 'responseBody' here if required. For ex, your status code is 200 but data might be empty resolve(); }); }); }; // Handle validation for negative scenario const validateNegativeCase = async function(res) { return new Promise((resolve, reject) => { if (res.statusCode < 400) { throw res.statusCode + ' ' + res.statusMessage; } resolve(); }); }; let requestOptionsStep1 = { 'hostname': 'myproductsEndpoint.com', Sample code for canary scripts 1830 Amazon CloudWatch 'method': 'GET', 'path': '/test/product/validProductName', 'port': 443, 'protocol': 'https:' }; let headers = {}; User Guide headers['User-Agent'] = [synthetics.getCanaryUserAgentString(), headers['User- Agent']].join(' '); requestOptionsStep1['headers'] = headers; // By default headers, post data and response body are not included in the report for security reasons. // Change the configuration at global level or add as step configuration for individual steps let stepConfig = { includeRequestHeaders: true, includeResponseHeaders: true, restrictedHeaders: ['X-Amz-Security-Token', 'Authorization'], // Restricted header values do not appear in report generated. includeRequestBody: true, includeResponseBody: true }; await synthetics.executeHttpStep('Verify GET products API with valid name', requestOptionsStep1, validatePositiveCase, stepConfig); let requestOptionsStep2 = { 'hostname': 'myproductsEndpoint.com', 'method': 'GET', 'path': '/test/canary/InvalidName(', 'port': 443, 'protocol': 'https:' }; headers = {}; headers['User-Agent'] = [synthetics.getCanaryUserAgentString(), headers['User- Agent']].join(' '); requestOptionsStep2['headers'] = headers; Sample code for canary scripts 1831 Amazon CloudWatch User Guide // By default headers, post data and response body are not included in the report for security reasons. // Change the configuration at global level or add as step configuration for individual steps stepConfig = { includeRequestHeaders: true, includeResponseHeaders: true, restrictedHeaders: ['X-Amz-Security-Token', 'Authorization'], // Restricted header values do not appear in report generated. includeRequestBody: true, includeResponseBody: true }; await synthetics.executeHttpStep('Verify GET products API with invalid name', requestOptionsStep2, validateNegativeCase, stepConfig); }; exports.handler = async () => { return await apiCanaryBlueprint(); }; Samples for Python and Selenium The following sample Selenium code is a canary that fails with a custom error message when a target element is not loaded. from aws_synthetics.selenium import synthetics_webdriver as webdriver from aws_synthetics.common import synthetics_logger as logger from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By def custom_selenium_script(): # create a
acw-ug-486
acw-ug.pdf
486
includeResponseHeaders: true, restrictedHeaders: ['X-Amz-Security-Token', 'Authorization'], // Restricted header values do not appear in report generated. includeRequestBody: true, includeResponseBody: true }; await synthetics.executeHttpStep('Verify GET products API with invalid name', requestOptionsStep2, validateNegativeCase, stepConfig); }; exports.handler = async () => { return await apiCanaryBlueprint(); }; Samples for Python and Selenium The following sample Selenium code is a canary that fails with a custom error message when a target element is not loaded. from aws_synthetics.selenium import synthetics_webdriver as webdriver from aws_synthetics.common import synthetics_logger as logger from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By def custom_selenium_script(): # create a browser instance browser = webdriver.Chrome() browser.get('https://www.example.com/') logger.info('navigated to home page') # set cookie browser.add_cookie({'name': 'foo', 'value': 'bar'}) browser.get('https://www.example.com/') # save screenshot browser.save_screenshot('signed.png') Sample code for canary scripts 1832 Amazon CloudWatch User Guide # expected status of an element button_condition = EC.element_to_be_clickable((By.CSS_SELECTOR, '.submit-button')) # add custom error message on failure WebDriverWait(browser, 5).until(button_condition, message='Submit button failed to load').click() logger.info('Submit button loaded successfully') # browser will be quit automatically at the end of canary run, # quit action is not necessary in the canary script browser.quit() # entry point for the canary def handler(event, context): return custom_selenium_script() Canaries and X-Ray tracing You can choose to enable active AWS X-Ray tracing on canaries that use the syn-nodejs-2.0 or later runtime. With tracing enabled, traces are sent for all calls made by the canary that use the browser, the AWS SDK, or HTTP or HTTPS modules. Canaries with tracing enabled appear on the X- Ray Trace Map, and within Application Signals after you have enabled it for your application. Note Activating X-Ray tracing on canaries is not yet supported in Asia Pacific (Jakarta). When a canary appears on the X-Ray trace map, it appears as a new client node type. You can hover on a canary node to see data about latency, requests, and faults. You can also choose the canary node to see more data at the bottom of the page. From this area of the page, you can choose View in Synthetics to jump to the CloudWatch Synthetics console for more details about the canary, or choose View Traces to see more details about the traces from this canary's runs. A canary with tracing enabled also has a Tracing tab in its details page, with details about traces and segments from the canary's runs. Enabling tracing increases canary run time by 2.5% to 7%. A canary with tracing enabled must use a role with the following permissions. If you use the console to create the role when you create the canary, it is given these permissions. { Canaries and X-Ray tracing 1833 Amazon CloudWatch User Guide "Version": "2012-10-17", "Statement": [ { "Sid": "Sid230934", "Effect": "Allow", "Action": [ "xray:PutTraceSegments" ], "Resource": "*" } ] } Traces generated by canaries incur charges. For more information about X-Ray pricing, see AWS X- Ray Pricing. Running a canary on a VPC You can run canaries on endpoints on a VPC and public internal endpoints. To run a canary on a VPC, you must have both the DNS Resolution and DNS hostnames options enabled on the VPC. For more information, see Using DNS with Your VPC. When you run a canary on a VPC endpoint, you must provide a way for it to send its metrics to CloudWatch and its artifacts to Amazon S3. If the VPC is already enabled for internet access, there's nothing more for you to do. The canary executes in your VPC, but can access the internet to upload its metrics and artifacts. If the VPC is not already enabled for internet access, you have two options: • Enable IPv4 internet access to allow the canary to send metrics to CloudWatch and Amazon S3. For more information, see the following section Giving internet access to your canary on a VPC. • If you want to keep your VPC private, you can configure the canary to send its data to CloudWatch and Amazon S3 through private VPC endpoints. If you have not already done so, you must create a VPC endpoint for CloudWatch (com.amazonaws.region.monitoring) and a gateway endpoint for Amazon S3. For more information, see Using CloudWatch, CloudWatch Synthetics, and CloudWatch Network Monitoring with interface VPC endpoints and Amazon VPC Endpoints for Amazon S3. Running a canary on a VPC 1834 Amazon CloudWatch User Guide Giving internet access to your canary on a VPC Follow these steps to give internet access to your VPC canary, or to assign your canary a static IP address To give internet access (IPv4) to a canary on a VPC 1. Create a NAT gateway in a public subnet on the VPC. For instructions, see Create a NAT gateway. 2. Add a new route to the route table in the private subnet where the canary is launched. Specify the following:
acw-ug-487
acw-ug.pdf
487
VPC endpoints and Amazon VPC Endpoints for Amazon S3. Running a canary on a VPC 1834 Amazon CloudWatch User Guide Giving internet access to your canary on a VPC Follow these steps to give internet access to your VPC canary, or to assign your canary a static IP address To give internet access (IPv4) to a canary on a VPC 1. Create a NAT gateway in a public subnet on the VPC. For instructions, see Create a NAT gateway. 2. Add a new route to the route table in the private subnet where the canary is launched. Specify the following: • For Destination, enter 0.0.0.0/0 • For Target, choose NAT Gateway, and then choose the ID of the NAT gateway that you created. • Choose Save routes. For more information about adding the route to the route table, see Add and remove routes from a route table. To give internet access (IPv6) to a canary on a VPC 1. Configure your VPC to have Dualstack subnets. You must add an Egress-Only Internet Gateway to the VPC, update the route tables to allow traffic to the Internet Gateway, and allow outbound access from the associated Security Groups. For more information, see Add IPv6 support for your VPC . 2. Set the Ipv6AllowedForDualstack in your canary VPC configuration using the CreateCanary or UpdateCanary API. For more information, see VpcConfigInput. To enable outbound IPv6 traffic from your canary, the VPC subnets attached to the canary must be enabled for Dualstack. Running a canary on a VPC 1835 Amazon CloudWatch Note User Guide Be sure that the routes to your NAT gateway are in an active status. If the NAT gateway is deleted and you haven't updated the routes, they're in a black hole status. For more information, see Work with NAT gateways. Encrypting canary artifacts CloudWatch Synthetics stores canary artifacts such as screenshots, HAR files, and reports in your Amazon S3 bucket. By default, these artifacts are encrypted at rest using an AWS managed key. For more information, see Customer keys and AWS keys. You can choose to use a different encryption option. CloudWatch Synthetics supports the following: • SSE-S3– Server-side encryption (SSE) with an Amazon S3-managed key. • SSE-KMS– Server-side encryption (SSE) with an AWS KMS customer managed key. If you want to use the default encryption option with an AWS managed key, you don't need any additional permissions. To use SSE-S3 encryption, you specify SSE_S3 as the encryption mode when you create or update your canary. You do not need any additional permissions to use this encryption mode. For more information, see Protecting data using server-side encryption with Amazon S3-managed encryption keys (SSE-S3). To use an AWS KMS customer managed key, you specify SSE-KMS as the encryption mode when you create or update your canary, and you also provide the Amazon Resource Name (ARN) of your key. You can also use a cross-account KMS key. To use a customer managed key, you need the following settings: • The IAM role for your canary must have permission to encrypt your artifacts using your key. If you are using visual monitoring, you must also give it permission to decrypt artifacts. { "Version": "2012-10-17", Encrypting canary artifacts 1836 Amazon CloudWatch User Guide "Statement": {"Effect": "Allow", "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "Your KMS key ARN" } } • Instead of adding permissions to your IAM role, you can add your IAM role to your key policy. If you use the same role for multiple canaries, you should consider this approach. { "Sid": "Enable IAM User Permissions", "Effect": "Allow", "Principal": { "AWS": "Your synthetics IAM role ARN" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "*" } • If you are using a cross-account KMS key, see Allowing users in other accounts to use a KMS key. Viewing encrypted canary artifacts when using a customer managed key To view canary artifacts, update your customer managed key to give AWS KMS the decrypt permission to the user viewing the artifacts. Alternatively, add decrypt permissions to the user or IAM role that is viewing the artifacts. The default AWS KMS policy enables IAM policies in the account to allow access to the KMS keys. If you are using a cross-account KMS key, see Why are cross-account users getting Access Denied errors when they try to access Amazon S3 objects encrypted by a custom AWS KMS key?. For more information about troubleshooting access denied issues because of a KMS key, see Troubleshooting key access. Encrypting canary artifacts 1837 Amazon CloudWatch User Guide Updating artifact location and encryption when using visual monitoring To perform visual monitoring, CloudWatch Synthetics compares your screenshots with baseline screenshots acquired in the run selected as the baseline. If you update your artifact location or encryption option, you must do one of the following: • Ensure
acw-ug-488
acw-ug.pdf
488
a cross-account KMS key, see Why are cross-account users getting Access Denied errors when they try to access Amazon S3 objects encrypted by a custom AWS KMS key?. For more information about troubleshooting access denied issues because of a KMS key, see Troubleshooting key access. Encrypting canary artifacts 1837 Amazon CloudWatch User Guide Updating artifact location and encryption when using visual monitoring To perform visual monitoring, CloudWatch Synthetics compares your screenshots with baseline screenshots acquired in the run selected as the baseline. If you update your artifact location or encryption option, you must do one of the following: • Ensure that your IAM role has sufficient permission for both the previous Amazon S3 location and the new Amazon S3 location for artifacts. Also ensure that it has permission for both the previous and new encryption methods and KMS keys. • Create a new baseline by selecting the next canary run as a new baseline. If you use this option, you only need to ensure that your IAM role has sufficient permissions for the new artifact location and encryption option. We recommend the second option of selecting the next run as the new baseline. This avoids having a dependency on an artifact location or encryption option that you're not using anymore for the canary. For example, suppose that your canary uses artifact location A and KMS key K for uploading artifacts. If you update your canary to artifact location B and KMS key L, you can ensure that your IAM role has permissions to both of the artifact locations (A and B) and both of the KMS keys (K and L). Alternatively, you can select the next run as the new baseline and ensure that your canary IAM role has permissions to artifact location B and KMS key L. Viewing canary statistics and details You can view details about your canaries and see statistics about their runs. To be able to see all the details about your canary run results, you must be logged on to an account that has sufficient permissions. For more information, see Required roles and permissions for CloudWatch canaries. To view canary statistics and details 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Synthetics Canaries. In the details about the canaries that you have created: • Status visually shows how many of your canaries have passed their most recent runs. Viewing canary statistics and details 1838 Amazon CloudWatch User Guide • Groups displays the groups you have created, and displays how many of them have failing or alarming canaries. • Slowest performers displays the group and the Region with the slowest-performing canaries. These are calculated by adding up the average duration of all canaries (across the time span selected) within a group or Region and dividing it by the number of canaries in the group or Region. If you choose the metric for Slowest group, the table is filtered to display only the slowest groups and their canaries. The table is sorted by Average Duration. • Near the bottom of the page is a table displaying all canaries. You can use the filtering bar to filter the table to show canaries by specific canary names, last run results, success percentage, alarms, run rates, canary state, runtimes, and unique tags. For the alarms column, only alarms that conform to the naming standard for canary alarms are displayed. This standard is Synthetics-Alarm-canaryName-index. Canary alarms that you create in the Synthetics section of the CloudWatch console automatically use this naming convention. If you create canary alarms in the Alarms section of the CloudWatch console or by using AWS CloudFormation, and you don't use this naming convention, the alarms work but they do not appear in this list. 3. To see more details about a single canary, choose the name of the canary in the Canaries table. In the details about that canary: • The Availability tab displays information about the recent runs of this canary. Under Canary runs, you can choose one of the lines to see details about that run. Under the graph, you can choose Steps, Screenshot, Logs, or HAR file to see these types of details. If the canary has active tracing enabled, you can also choose Traces to see tracing information from the canary's runs. The logs for canary runs are stored in S3 buckets and in CloudWatch Logs. Screenshots show how your customers view your webpages. You can use the HAR files (HTTP Archive files) to view detailed performance data about the webpages. You can analyze the list of web requests and catch performance issues such as time to load for an item. Log files show the record of interactions between the canary run and the webpage and can be used to identify details of errors. Viewing canary
acw-ug-489
acw-ug.pdf
489
active tracing enabled, you can also choose Traces to see tracing information from the canary's runs. The logs for canary runs are stored in S3 buckets and in CloudWatch Logs. Screenshots show how your customers view your webpages. You can use the HAR files (HTTP Archive files) to view detailed performance data about the webpages. You can analyze the list of web requests and catch performance issues such as time to load for an item. Log files show the record of interactions between the canary run and the webpage and can be used to identify details of errors. Viewing canary statistics and details 1839 Amazon CloudWatch User Guide If the canary uses the syn-nodejs-2.0-beta runtime or later, you can sort the HAR files by status code, request size, or duration. The Steps tab displays a list of the canary's steps, each step's status, failure reason, URL after step execution, screenshots, and duration of step execution. For API canaries with HTTP steps, you can view steps and corresponding HTTP requests if you are using runtime syn- nodejs-2.2 or later. Choose the HTTP Requests tab to view the log of each HTTP request made by the canary. You can view request/response headers, response body, status code, error and performance timings (total duration, TCP connection time, TLS handshake time, first byte time, and content transfer time). All HTTP requests which use the HTTP/HTTPS module under the hood are captured here. By default in API canaries, the request header, response header, request body, and response body are not included in the report for security reasons. If you choose to include them, the data is stored only in your S3 bucket. For information about how to include this data in the report, see executeHttpStep(stepName, requestOptions, [callback], [stepConfig]). Response body content types of text, HTML and JSON are supported. Content types like text/HTML, text/plain, application/JSON and application/x-amz-json-1.0 are supported. Compressed responses are not supported. • The Monitoring tab displays graphs of the CloudWatch metrics published by this canary. For more information about these metrics, see CloudWatch metrics published by canaries. Below the CloudWatch graphics published by the canary are graphs of Lambda metrics related to the canary's Lambda code. • The Configuration tab displays configuration and schedule information about the canary. • The Groups tab displays the groups that this canary is associated with, if any. • The Tags tab displays the tags associated with the canary. CloudWatch metrics published by canaries Canaries publish the following metrics to CloudWatch in the CloudWatchSynthetics namespace. For more information about viewing CloudWatch metrics, see View available metrics. CloudWatch metrics published by canaries 1840 Amazon CloudWatch User Guide Metric Description SuccessPe rcentDryRun The success percentage of DryRun executions. Valid Dimensions: CanaryName Valid Statistic: Average Units: Percent DurationDryRun The duration of DryRun executions. Valid Dimensions: CanaryName Valid Statistic: Average Units: Milliseconds SuccessPercent The percentage of the runs of this canary that succeed and find no failures. Valid Dimensions: CanaryName Valid Statistic: Average Units: Percent Duration The duration in milliseconds of the canary run. Valid Dimensions: CanaryName Valid Statistic: Average Units: Milliseconds Error The number of times the canary failed to run its full script. Valid Dimensions: CanaryName Valid Statistic: Sum CloudWatch metrics published by canaries 1841 Amazon CloudWatch Metric 2xx User Guide Description The number of network requests performed by the canary that returned OK responses, with response codes between 200 and 299. This metric is reported for UI canaries that use runtime version syn- nodejs-2.0 or later, and is reported for API canaries that use runtime version syn-nodejs-2.2 or later. Valid Dimensions: CanaryName Valid Statistic: Sum Units: Count 4xx The number of network requests performed by the canary that returned Error responses, with response codes between 400 and 499. This metric is reported for UI canaries that use runtime version syn- nodejs-2.0 or later, and is reported for API canaries that use runtime version syn-nodejs-2.2 or later. Valid Dimensions: CanaryName Valid Statistic: Sum Units: Count 5xx The number of network requests performed by the canary that returned Fault responses, with response codes between 500 and 599. This metric is reported for UI canaries that use runtime version syn- nodejs-2.0 or later, and is reported for API canaries that use runtime version syn-nodejs-2.2 or later. Valid Dimensions: CanaryName Valid Statistic: Sum Units: Count CloudWatch metrics published by canaries 1842 Amazon CloudWatch Metric Failed Description The number of canary runs that failed to execute. These failures are related to the canary itself. User Guide Valid Dimensions: CanaryName Valid Statistic: Sum Units: Count Failed requests The number of HTTP requests executed by the canary on the target website that failed with no response. Valid Dimensions: CanaryName Valid Statistic: Sum Units: Count VisualMon itoringSu ccessPercent VisualMon itoringTo talComparisons The percentage of visual comparisons that successfully matched the baseline screenshots during a canary run. Valid
acw-ug-490
acw-ug.pdf
490
version syn-nodejs-2.2 or later. Valid Dimensions: CanaryName Valid Statistic: Sum Units: Count CloudWatch metrics published by canaries 1842 Amazon CloudWatch Metric Failed Description The number of canary runs that failed to execute. These failures are related to the canary itself. User Guide Valid Dimensions: CanaryName Valid Statistic: Sum Units: Count Failed requests The number of HTTP requests executed by the canary on the target website that failed with no response. Valid Dimensions: CanaryName Valid Statistic: Sum Units: Count VisualMon itoringSu ccessPercent VisualMon itoringTo talComparisons The percentage of visual comparisons that successfully matched the baseline screenshots during a canary run. Valid Dimensions: CanaryName Valid Statistic: Average Units: Percent The total number of visual comparisons that happened during a canary run. Valid Dimensions: CanaryName Units: Count CloudWatch metrics published by canaries 1843 Amazon CloudWatch Note User Guide Canaries that use either the executeStep() or executeHttpStep() methods from the Synthetics library also publish SuccessPercent and Duration metrics with the dimensions CanaryName and StepName for each step. Edit or delete a canary You can edit or delete an existing canary. Edit canary When you edit a canary, even if you don't change its schedule, the schedule is reset corresponding to when you edit the canary. For example, if you have a canary that runs every hour, and you edit that canary, the canary will run immediately after the edit is completed and then every hour after that. To edit or update a canary 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. 4. In the navigation pane, choose Application Signals, Synthetics Canaries. Select the button next to the canary name, and choose Actions, Edit. (Optional) If this canary performs visual monitoring of screenshots and you want to set the next run of the canary as the baseline, select Set next run as new baseline. 5. (Optional) If this canary performs visual monitoring of screenshots and you want to remove a screenshot from visual monitoring or you want to designate parts of the screenshot to be ignored during visual comparisons, under Visual Monitoring choose Edit Baseline. The screenshot appears, and you can do one of the following: • To remove the screenshot from being used for visual monitoring, select Remove screenshot from visual test baseline. • To designate parts of the screenshot to be ignored during visual comparisons, click and drag to draw areas of the screen to ignore. Once you have done this for all the areas that you want to ignore during comparisons, choose Save. 6. Make any other changes to the canary that you'd like, and choose Save. Edit or delete a canary 1844 Amazon CloudWatch Delete canary User Guide When you delete a canary, you can choose whether to also delete other resources used and created by the canary. If the canary’s ProvisionedResourceCleanup field is set to AUTOMATIC or DeleteLambda is specified as true when you delete the canary, CloudWatch Synthetics will automatically delete the Lambda functions and layers that are used by the canary. When you delete a canary, you should also delete the following: • Lambda functions and layers used by this canary. Their prefix is cwsyn-MyCanaryName. • CloudWatch alarms created for this canary. These alarms have a name that starts with Synthetics-Alarm-MyCanaryName. For more information about deleting alarms, see Edit or delete a CloudWatch alarm. • Amazon S3 objects and buckets, such as the canary's results location and artifact location. • IAM roles created for the canary. These have the name role/service-role/ CloudWatchSyntheticsRole-MyCanaryName. • Log groups in CloudWatch Logs created for the canary. These logs groups have the following names: /aws/lambda/cwsyn-MyCanaryName-randomId. Before you delete a canary, you might want to view the canary details and make note of this information. That way, you can delete the correct resources after you delete the canary. To delete a canary 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Application Signals, Synthetics Canaries. If the canary is currently in the RUNNING state, you must stop it. Only canaries in the STOPPED, READY(NOT_STARTED), or ERROR states can be deleted. To stop the canary, select the button next to the canary name, and choose Actions, Stop. 4. Select the button next to the canary name, and choose Actions, Delete. 5. Choose whether to also delete the other resources created for and used by the canary. Lambda functions and layers will be deleted alongside the canary, but you can additionally choose to delete the canary's IAM role and IAM policy. Enter Delete into the box and choose Delete. 6. Delete the other resources used by and created for the canary, as listed earlier in this section. Edit or delete a canary 1845 Amazon CloudWatch User Guide Start, stop, delete, or update runtime for multiple canaries You can stop, start, delete, or update the runtime of as many as five
acw-ug-491
acw-ug.pdf
491
Delete. 5. Choose whether to also delete the other resources created for and used by the canary. Lambda functions and layers will be deleted alongside the canary, but you can additionally choose to delete the canary's IAM role and IAM policy. Enter Delete into the box and choose Delete. 6. Delete the other resources used by and created for the canary, as listed earlier in this section. Edit or delete a canary 1845 Amazon CloudWatch User Guide Start, stop, delete, or update runtime for multiple canaries You can stop, start, delete, or update the runtime of as many as five canaries with one action. If you update the runtime of a canary, it is updated to the latest runtime available for the language and framework that the canary uses. If you select multiple canaries and only some of them are in a state that is valid for the action that you select, the action is performed only on the canaries where that action is valid. For example, if you select some canaries that are currently running and some that are not, and you select to start the canaries, the canaries that weren't already running will start, and the canaries that were already running are not affected. If none of the canaries that you select are valid for an action, that action will not be available in the menu. 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Application Signals, Synthetics Canaries. Select the check boxes next to the canaries that you want to stop, start, or delete. 4. Choose Actions and then choose either Start, Stop, Delete, Start Dry Run, or Update Runtime. In addition, when choosing Update Runtime, you can choose to dry run the runtime update first before committing the change. Monitoring canary events with Amazon EventBridge Amazon EventBridge event rules can notify you when canaries change status or complete runs. EventBridge delivers a near-real-time stream of system events that describe changes in AWS resources. CloudWatch Synthetics sends these events to EventBridge on a best effort basis. Best effort delivery means that CloudWatch Synthetics attempts to send all events to EventBridge, but in some rare cases an event might not be delivered. EventBridge processes all received events at least once. Additionally, your event listeners might not receive the events in the order that the events occurred. Start, stop, delete, or update runtime for multiple canaries 1846 Amazon CloudWatch Note User Guide Amazon EventBridge is an event bus service that you can use to connect your applications with data from a variety of sources. For more information, see What is Amazon EventBridge? in the Amazon EventBridge User Guide. CloudWatch Synthetics emits an event when a canary changes state or completes a run. You can create an EventBridge rule that includes an event pattern to match all event types sent from CloudWatch Synthetics, or that matches only specific event types. When a canary triggers a rule, EventBridge invokes the target actions defined in the rule. This allows you to send notifications, capture event information, and take corrective action, in response to a canary state change or the completion of a canary run. For example, you can create rules for the following use cases: • Investigating when a canary run fails • Investigating when a canary has gone into the ERROR state • Tracking a canary's life cycle • Monitoring canary run success or failure as part of a workflow Example events from CloudWatch Synthetics This section lists example events from CloudWatch Synthetics. For more information about event format, see Events and Event Patterns in EventBridge. Canary status change In this event type, the values of current-state and previous-state can be the following: CREATING | READY | STARTING | RUNNING | UPDATING | STOPPING | STOPPED | ERROR { "version": "0", "id": "8a99ca10-1e97-2302-2d64-316c5dedfd61", "detail-type": "Synthetics Canary Status Change", "source": "aws.synthetics", "account": "123456789012", "time": "2021-02-09T22:19:43Z", "region": "us-east-1", "resources": [], Monitoring canary events with Amazon EventBridge 1847 Amazon CloudWatch "detail": { User Guide "account-id": "123456789012", "canary-id": "EXAMPLE-dc5a-4f5f-96d1-989b75a94226", "canary-name": "events-bb-1", "current-state": "STOPPED", "previous-state": "UPDATING", "source-location": "NULL", "updated-on": 1612909161.767, "changed-config": { "executionArn": { "previous-value": "arn:aws:lambda:us-east-1:123456789012:function:cwsyn-events-bb-1-af3e3a05- dc5a-4f5f-96d1-989EXAMPLE:1", "current-value": "arn:aws:lambda:us-east-1:123456789012:function:cwsyn-events-bb-1-af3e3a05- dc5a-4f5f-96d1-989EXAMPLE:2" }, "vpcId": { "current-value": "NULL" }, "testCodeLayerVersionArn": { "previous- value": "arn:aws:lambda:us-east-1:123456789012:layer:cwsyn-events-bb-1-af3e3a05- dc5a-4f5f-96d1-989EXAMPLE:1", "current-value": "arn:aws:lambda:us-east-1:123456789012:layer:cwsyn-events-bb-1-af3e3a05- dc5a-4f5f-96d1-989EXAMPLE:2" } }, "message": "Canary status has changed" } } Successful canary run completed { "version": "0", "id": "989EXAMPLE-f4a5-57a7-1a8f-d9cc768a1375", "detail-type": "Synthetics Canary TestRun Successful", "source": "aws.synthetics", "account": "123456789012", "time": "2021-02-09T22:24:01Z", "region": "us-east-1", Monitoring canary events with Amazon EventBridge 1848 Amazon CloudWatch User Guide "resources": [], "detail": { "account-id": "123456789012", "canary-id": "989EXAMPLE-dc5a-4f5f-96d1-989b75a94226", "canary-name": "events-bb-1", "canary-run-id": "c6c39152-8f4a-471c-9810-989EXAMPLE", "artifact-location": "cw-syn-results-123456789012-us- east-1/canary/us-east-1/events-bb-1-ec3-28ddbe266797/2021/02/09/22/23-41-200", "test-run-status": "PASSED", "state-reason": "null", "canary-run-timeline": { "started": 1612909421, "completed": 1612909441 }, "message": "Test run result is generated successfully" } } Failed canary run completed { "version": "0", "id": "2644b18f-3e67-5ebf-cdfd-bf9f91392f41", "detail-type": "Synthetics Canary TestRun Failure", "source": "aws.synthetics", "account": "123456789012", "time":
acw-ug-492
acw-ug.pdf
492
dc5a-4f5f-96d1-989EXAMPLE:1", "current-value": "arn:aws:lambda:us-east-1:123456789012:layer:cwsyn-events-bb-1-af3e3a05- dc5a-4f5f-96d1-989EXAMPLE:2" } }, "message": "Canary status has changed" } } Successful canary run completed { "version": "0", "id": "989EXAMPLE-f4a5-57a7-1a8f-d9cc768a1375", "detail-type": "Synthetics Canary TestRun Successful", "source": "aws.synthetics", "account": "123456789012", "time": "2021-02-09T22:24:01Z", "region": "us-east-1", Monitoring canary events with Amazon EventBridge 1848 Amazon CloudWatch User Guide "resources": [], "detail": { "account-id": "123456789012", "canary-id": "989EXAMPLE-dc5a-4f5f-96d1-989b75a94226", "canary-name": "events-bb-1", "canary-run-id": "c6c39152-8f4a-471c-9810-989EXAMPLE", "artifact-location": "cw-syn-results-123456789012-us- east-1/canary/us-east-1/events-bb-1-ec3-28ddbe266797/2021/02/09/22/23-41-200", "test-run-status": "PASSED", "state-reason": "null", "canary-run-timeline": { "started": 1612909421, "completed": 1612909441 }, "message": "Test run result is generated successfully" } } Failed canary run completed { "version": "0", "id": "2644b18f-3e67-5ebf-cdfd-bf9f91392f41", "detail-type": "Synthetics Canary TestRun Failure", "source": "aws.synthetics", "account": "123456789012", "time": "2021-02-09T22:24:27Z", "region": "us-east-1", "resources": [], "detail": { "account-id": "123456789012", "canary-id": "af3e3a05-dc5a-4f5f-96d1-9989EXAMPLE", "canary-name": "events-bb-1", "canary-run-id": "0df3823e-7e33-4da1-8194- b04e4d4a2bf6", "artifact-location": "cw-syn-results-123456789012-us- east-1/canary/us-east-1/events-bb-1-ec3-989EXAMPLE/2021/02/09/22/24-21-275", "test-run-status": "FAILED", "state-reason": "\"Error: net::ERR_NAME_NOT_RESOLVED \"" "canary-run-timeline": { "started": 1612909461, "completed": 1612909467 Monitoring canary events with Amazon EventBridge 1849 Amazon CloudWatch User Guide }, "message": "Test run result is generated successfully" } } It's possible that events might be duplicated or out of order. To determine the order of events, use the time property. Prerequisites for creating EventBridge rules Before you create an EventBridge rule for CloudWatch Synthetics, you should do the following: • Familiarize yourself with events, rules, and targets in EventBridge. • Create and configure the targets invoked by your EventBridge rules. Rules can invoke many types of targets, including: • Amazon SNS topics • AWS Lambda functions • Kinesis streams • Amazon SQS queues For more information, see What is Amazon EventBridge? and Getting started with Amazon EventBridge in the Amazon EventBridge User Guide. Create an EventBridge rule (CLI) The steps in the following example create an EventBridge rule that publishes an Amazon SNS topic when the canary named my-canary-name in us-east-1 completes a run or changes state. 1. Create the rule. aws events put-rule \ --name TestRule \ --region us-east-1 \ --event-pattern "{\"source\": [\"aws.synthetics\"], \"detail\": {\"canary-name\": [\"my-canary-name\"]}}" Any properties you omit from the pattern are ignored. 2. Add the topic as a rule target. Monitoring canary events with Amazon EventBridge 1850 Amazon CloudWatch User Guide • Replace topic-arn with the Amazon Resource Name (ARN) of your Amazon SNS topic. aws events put-targets \ --rule TestRule \ --targets "Id"="1","Arn"="topic-arn" Note To allow Amazon EventBridge to call your target topic, you must add a resource-based policy to your topic. For more information, see Amazon SNS permissions in the Amazon EventBridge User Guide. For more information, see Events and event patterns in EventBridge in the Amazon EventBridge User Guide. Performing safe canary updates CloudWatch synthetics safe canary updates allows you to test the updates on your existing canaries before applying the changes. This feature helps you validate canary compatibility with new run times and other configuration changes such as code or memory changes. This will help minimize potential monitoring disruptions caused by erroneous updates. By using canary safe updates on runtime version updates, configuration changes, and code script modifications, you can mitigate risk, maintain uninterrupted monitoring, verify the changes before committing, update, and reduce downtime. Topics • Prerequisites • Best practices • Testing canary using dry run • Limitations Prerequisites Make sure the prequisites are complete. Performing safe canary updates 1851 Amazon CloudWatch User Guide • AWS account with CloudWatch synthetics permissions • Existing canary on the supported runtime versions (see Limitations for compatible runtimes) • Include compatible runtimes when performing a dry run (see Limitations for compatible runtimes) Best practices Here are some best practices to follow while performing a canary . • Execute a dry run to validate a runtime update • Perform dry runs before production updates to canary • Review canary logs and artifacts after a dry run • Use dry runs to validate dependencies and library compatibility Testing canary using dry run You can test the canary update using the following options: Using the AWS Management Console's Edit workflow 1. Go the CloudWatch synthetics console. 2. 3. Select the canary you want to update. From the Actions drop down, choose Edit. Update the canary with the changes you want to test. For example, changing runtime version or editing the script’s code. 4. Under Canary script, choose Start Dry Run to test and view the results immediately or choose Validate and save later at the bottom of the page to start the test and view the results later in your Canary Details page. 5. After the dry run succeeds, choose Submit to commit your canary updates. Using the AWS Management Console for updating canaries in a batch 1. Go the CloudWatch synthetics console. 2. Choose the Synthetics list page. Performing safe canary updates 1852 Amazon CloudWatch User Guide 3. 4. Select upto five canaries for which you want to update the runtime. From the Actions drop down, choose Update Runtime. 5. Choose Start dry run for new runtime to start the dry run and test your
acw-ug-493
acw-ug.pdf
493
of the page to start the test and view the results later in your Canary Details page. 5. After the dry run succeeds, choose Submit to commit your canary updates. Using the AWS Management Console for updating canaries in a batch 1. Go the CloudWatch synthetics console. 2. Choose the Synthetics list page. Performing safe canary updates 1852 Amazon CloudWatch User Guide 3. 4. Select upto five canaries for which you want to update the runtime. From the Actions drop down, choose Update Runtime. 5. Choose Start dry run for new runtime to start the dry run and test your changes before an update. 6. On the Synthetics list page, you will see a text next to the Runtime version for the canary that displays the progress of the dry run (this is only displayed for dry runs involving a runtime update). Once the dry run succeeds, you will see an Initiate Update text. 7. Choose Initiate Update to commit the runtime update. 8. If the dry run fails, you will see an Update dry run failed text. Choose the text to view the debug link to the canary details page. Using the AWS CLI or SDK The API starts the dry run for the provided canary name MyCanary and updates the runtime version to syn-nodejs-puppeteer-10.0. aws synthetics start-canary-dry-run \ --name MyCanary \ --runtime-version syn-nodejs-puppeteer-10.0 // Or if you wanted to update other configurations: aws synthetics start-canary-dry-run \ --name MyCanary \ --execution-role-arn arn:aws:iam::123456789012:role/NewRole The API will return the DryRunId inside the DryRunConfigOutput. Call GetCanary with the provided DryRunId to receive the canary’s dry run configurations and an additional field DryRunConfig which contains the status of the dry run listed as LastDryRunExecutionStatus. aws synthetics get-canary \ --name MyCanary \ --dry-run-id XXXX-XXXX-XXXX-XXXX Performing safe canary updates 1853 Amazon CloudWatch User Guide For more details, use GetCanaryRuns with the provided DryRunId to retrieve the run and additional information. aws synthetics get-canary-runs \ --name MyCanary \ --dry-run-id XXXX-XXXX-XXXX-XXXX After a successful dry run, you can then use UpdateCanary with the provided DryRunId in order to commit your changes. aws synthetics update-canary \ --name MyCanary \ --dry-run-id XXXX-XXXX-XXXX-XXXX When it fails for any reason (result from GetCanaryRuns will have the details), the result from GetCanaryRuns has an artifact location that contains logs to debug. When there are no logs, the dry run failed to be created. You can validate by using GetCanary. aws synthetics get-canary \ --name MyCanary \ --dry-run-id XXXX-XXXX-XXXX-XXXX The State, StateReason, and StateReasonCode displays the status of the dry run. Using AWS CloudFormation In your template for a Synthetics Canary, provide the field DryRunAndUpdate which accepts a boolean value true or false. when the value is true every update executes a dry run to validate the changes before automatically updating the canary. When the dry run fails, the canary does not update and fails the deployment and AWS CloudFormation deployment with a valid reason. To debug this issue, use the AWS Synthetics console or if using an API, get the ArtifactS3Location using the GetCanaryRuns API, and download the *-log.txt files to review the canary log executions for errors. After validation, modify the AWS CloudFormation template and retry the deployment or use the above API to validate. When the value is false, synthetics will not execute a dry run to validate changes and will directly commit your updates. Performing safe canary updates 1854 Amazon CloudWatch User Guide For information on troubleshooting a failed canary, see Troubleshooting a failed canary. An example template. SyntheticsCanary: Type: 'AWS::Synthetics::Canary' Properties: Name: MyCanary RuntimeVersion: syn-nodejs-puppeteer-10.0 Schedule: {Expression: 'rate(5 minutes)', DurationInSeconds: 3600} ... DryRunAndUpdate: true Limitations • Supports runtime versions – syn-nodejs-puppeteer-10.0+, syn-nodejs-playwright-2.0+, and syn- python-selenium-5.1+ • You can only execute one dry run per canary at a time • When a dry run fails, you cannot update the canary • Dry run cannot test any Schedule field changes Note When you initiate a dry run with code changes for a Playwright canary and you want to update the canary without providing the associated DryRunId, you must explicitly specify the code parameters. CloudWatch RUM With CloudWatch RUM, you can perform real user monitoring to collect and view client-side data about your web application performance from actual user sessions in near real time. The data that you can visualize and analyze includes page load times, client-side errors, and user behavior. When you view this data, you can see it all aggregated together and also see breakdowns by the browsers and devices that your customers use. You can use the collected data to quickly identify and debug client-side performance issues. CloudWatch RUM helps you visualize anomalies in your application performance and find relevant CloudWatch RUM 1855 Amazon CloudWatch User Guide debugging data such as error messages, stack traces, and user sessions. You can also use RUM to understand the range of
acw-ug-494
acw-ug.pdf
494
near real time. The data that you can visualize and analyze includes page load times, client-side errors, and user behavior. When you view this data, you can see it all aggregated together and also see breakdowns by the browsers and devices that your customers use. You can use the collected data to quickly identify and debug client-side performance issues. CloudWatch RUM helps you visualize anomalies in your application performance and find relevant CloudWatch RUM 1855 Amazon CloudWatch User Guide debugging data such as error messages, stack traces, and user sessions. You can also use RUM to understand the range of end user impact including the number of users, geolocations, and browsers used. End user data that you collect for CloudWatch RUM is retained for 30 days and then automatically deleted. If you want to keep the RUM events for a longer time, you can choose to have the app monitor send copies of the events to CloudWatch Logs in your account. Then, you can adjust the retention period for that log group. To use RUM, you create an app monitor and provide some information. RUM generates a JavaScript snippet for you to paste into your application. The snippet pulls in the RUM web client code. The RUM web client captures data from a percentage of your application's user sessions, which is displayed in a pre-built dashboard. You can specify what percentage of user sessions to gather data from. CloudWatch RUM is integrated with Application Signals, which can discover and monitor your application services, clients, Synthetics canaries, and service dependencies. Use Application Signals to see a list or visual map of your services, view health metrics based on your service level objectives (SLOs), and drill down to see correlated X-Ray traces for more detailed troubleshooting. To see RUM client page requests in Application Signals, turn on X-Ray active tracing by creating an app monitor, or manually configuring the RUM web client. Your RUM clients are displayed on the Service Map connected to your services, and in the Service detail page of the services they call. The RUM web client is open source. For more information, see CloudWatch RUM web client. Performance considerations This section discusses the performance considerations of using CloudWatch RUM. • Load performance impact— The CloudWatch RUM web client can be installed in your web application as a JavaScript module, or loaded into your web application asynchronously from a content delivery network (CDN). It does not block the application’s load process. CloudWatch RUM is designed to have no perceptible impact on application load time. • Runtime impact— The RUM web client performs processing to record and dispatch RUM data to the CloudWatch RUM service. Because events are infrequent and the amount of processing is small, CloudWatch RUM is designed for there to be no detectable impact to the application’s performance. • Network impact— The RUM web client periodically sends data to the CloudWatch RUM service. Data is dispatched at regular intervals while the application is running, and also immediately CloudWatch RUM 1856 Amazon CloudWatch User Guide before the browser unloads the application. Data sent immediately before the browser unloads the application are sent as beacons, which, are designed to have no detectable impact on the application’s unload time. RUM Pricing With CloudWatch RUM, you incur charges for every RUM event that CloudWatch RUM receives. Each data item collected using the RUM web client is considered a RUM event. Examples of RUM events include a page view, a JavaScript error, and an HTTP error. You have options for which types of events are collected by each app monitor. You can activate or deactivate options to collect performance telemetry events, JavaScript errors, HTTP errors, and X-Ray traces. For more information about choosing these options, see Creating a CloudWatch RUM app monitor and Information collected by the CloudWatch RUM web client. For more information about pricing, see Amazon CloudWatch Pricing. Region availability CloudWatch RUM is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (N. California) • US West (Oregon) • Africa (Cape Town) • Asia Pacific (Jakarta) • Asia Pacific (Mumbai) • Asia Pacific (Hyderabad) • Asia Pacific (Melbourne) • Asia Pacific (Osaka) • Asia Pacific (Seoul) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Asia Pacific (Hong Kong) • Canada (Central) CloudWatch RUM 1857 User Guide Amazon CloudWatch • Europe (Frankfurt) • Europe (Ireland) • Europe (London) • Europe (Milan) • Europe (Paris) • Europe (Spain) • Europe (Stockholm) • Europe (Zurich) • Middle East (Bahrain) • Middle East (UAE) • South America (São Paulo) • Israel (Tel Aviv) Topics • IAM policies to use CloudWatch RUM • Set up an application to use CloudWatch RUM • Using resource-based policies with CloudWatch RUM • Configuring the
acw-ug-495
acw-ug.pdf
495
(Osaka) • Asia Pacific (Seoul) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Asia Pacific (Hong Kong) • Canada (Central) CloudWatch RUM 1857 User Guide Amazon CloudWatch • Europe (Frankfurt) • Europe (Ireland) • Europe (London) • Europe (Milan) • Europe (Paris) • Europe (Spain) • Europe (Stockholm) • Europe (Zurich) • Middle East (Bahrain) • Middle East (UAE) • South America (São Paulo) • Israel (Tel Aviv) Topics • IAM policies to use CloudWatch RUM • Set up an application to use CloudWatch RUM • Using resource-based policies with CloudWatch RUM • Configuring the CloudWatch RUM web client • Enabling unminification of JavaScript error stack traces • Regionalization • Use page groups • Specify custom metadata • Send custom events • Viewing the CloudWatch RUM dashboard • CloudWatch metrics that you can collect with CloudWatch RUM • Data protection and data privacy with CloudWatch RUM • Information collected by the CloudWatch RUM web client • Manage your applications that use CloudWatch RUM • CloudWatch RUM quotas • Troubleshooting CloudWatch RUM CloudWatch RUM 1858 Amazon CloudWatch User Guide IAM policies to use CloudWatch RUM To be able to fully manage CloudWatch RUM, you must be signed in as an IAM user or role that has the AmazonCloudWatchRUMFullAccess IAM policy. Additionally, you may need other policies or permissions: • To create an app monitor that creates a new Amazon Cognito identity pool for authorization, you need to have the Admin IAM role or the AdministratorAccess IAM policy. • To create an app monitor that sends data to CloudWatch Logs, you must be logged on to an IAM role or policy that has the following permission: { "Effect": "Allow", "Action": [ "logs:PutResourcePolicy" ], "Resource": [ "*" ] } • To enable JavaScript source maps in an app monitor, you will need to upload your source map files to a Amazon S3 bucket. Your IAM role or policy needs specific Amazon S3 permissions that allow creating Amazon S3 buckets, setting bucket policies, and managing files in the bucket. For security, scope these permissions to specific resources. The example policy below restricts access to buckets containing rum in their names and uses the aws:ResourceAccount condition key to limit permissions to the principal account only. { "Sid": "AllowS3BucketCreationAndListing", "Effect": "Allow", "Action": [ "s3:CreateBucket", "s3:ListAllMyBuckets" ], "Resource": "arn:aws:s3:::*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } IAM policies to use CloudWatch RUM 1859 User Guide Amazon CloudWatch }, { "Sid": "AllowS3BucketActions", "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:ListBucket" ], "Resource": "arn:aws:s3:::*rum*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "AllowS3BucketPolicyActions", "Effect": "Allow", "Action": [ "s3:PutBucketPolicy", "s3:GetBucketPolicy" ], "Resource": "arn:aws:s3:::*rum*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } }, { "Sid": "AllowS3ObjectActions", "Effect": "Allow", "Action": [ "s3:GetObject", "s3:PutObject", "s3:DeleteObject", "s3:AbortMultipartUpload" ], "Resource": "arn:aws:s3:::*rum*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } IAM policies to use CloudWatch RUM 1860 Amazon CloudWatch } User Guide • To use your own AWS KMS keys for server-side encryption on your source map bucket, your IAM role or policy will need specific AWS KMS permissions that allows creating a key, updating the key policy, using the AWS KMS key with Amazon S3 and setting the encryption configuration of your Amazon S3 bucket. For security, scope these permissions to specific purposes. The example below restricts access to keys for a specific region and accountId and has similar S3 restrictions as the above example. { "Sid": "AllowKMSKeyCreation", "Effect": "Allow", "Action": [ "kms:CreateKey", "kms:CreateAlias" ], "Resource": "*" }, { "Sid": "KMSReadPermissions", "Effect": "Allow", "Action": [ "kms:ListAliases" ], "Resource": "*" }, { "Sid": "AllowUpdatingKeyPolicy", "Effect": "Allow", "Action": [ "kms:PutKeyPolicy", "kms:GetKeyPolicy", "kms:ListKeyPolicies" ], "Resource": "arn:aws:kms:REGION:ACCOUNT_ID:key/*" }, { "Sid": "AllowUseOfKMSKeyForS3", "Effect": "Allow", "Action": [ "kms:DescribeKey", "kms:Encrypt", "kms:Decrypt", IAM policies to use CloudWatch RUM 1861 Amazon CloudWatch User Guide "kms:GenerateDataKey" ], "Resource": "arn:aws:kms:REGION:ACCOUNT_ID:key/*" }, { "Sid": "AllowS3EncryptionConfiguration", "Effect": "Allow", "Action": [ "s3:PutEncryptionConfiguration", "s3:GetEncryptionConfiguration" ], "Resource": "arn:aws:s3:::*rum*", "Condition": { "StringEquals": { "aws:ResourceAccount": "${aws:PrincipalAccount}" } } } Other users who need to view CloudWatch RUM data but don't need to create CloudWatch RUM resources, can be granted the AmazonCloudWatchRUMReadOnlyAccess policy. Set up an application to use CloudWatch RUM Use the steps in these sections to set up your application to begin using CloudWatch RUM to collect performance data from real user sessions. Topics • Step 1: Authorize your application to send data to AWS • Creating a CloudWatch RUM app monitor • Modifying the code snippet to configure the CloudWatch RUM web client (optional) • Inserting the CloudWatch app monitor code snippet into your application • Testing your CloudWatch app monitor setup by generating user events Step 1: Authorize your application to send data to AWS You have four options to set up data authentication: Set up an application to use CloudWatch RUM 1862 Amazon CloudWatch User Guide • Use Amazon Cognito and let
acw-ug-496
acw-ug.pdf
496
to collect performance data from real user sessions. Topics • Step 1: Authorize your application to send data to AWS • Creating a CloudWatch RUM app monitor • Modifying the code snippet to configure the CloudWatch RUM web client (optional) • Inserting the CloudWatch app monitor code snippet into your application • Testing your CloudWatch app monitor setup by generating user events Step 1: Authorize your application to send data to AWS You have four options to set up data authentication: Set up an application to use CloudWatch RUM 1862 Amazon CloudWatch User Guide • Use Amazon Cognito and let CloudWatch RUM create a new Amazon Cognito identity pool for the application. This method requires the least effort to set up. The identity pool will contain an unauthenticated identity. This allows the CloudWatch RUM web client to send data to CloudWatch RUM without authenticating the user of the application. The Amazon Cognito identity pool has an attached IAM role. The Amazon Cognito unauthenticated identity allows the web client to assume the IAM role that is authorized to send data to CloudWatch RUM. • Use Amazon Cognito for authentication. If you use this, you can use an existing Amazon Cognito identity pool or create a new one to use with this app monitor. If you use an existing identity pool, you must also modify the IAM role that is attached to the identity pool. Use this option for identity pools that support unauthenticated users. You can use identity pools only from the same Region. • Use authentication from an existing identity provider that you have already set up. In this case, you must get credentials from the identity provider and your application must forward these credentials to the RUM web client. Use this option for identity pools that support only authenticated users. • Use resource-based policies to manage access to your app monitor. This includes the ability to send unauthenticated requests to CloudWatch RUM without AWS credentials. To learn more about resource based policies and RUM, see Using resource-based policies with CloudWatch RUM. The following sections include more details about these options. Use an existing Amazon Cognito identity pool If you choose to use a Amazon Cognito identity pool, you specify the identity pool when you add the application to CloudWatch RUM. The pool must support enabling access to unauthenticated identities. You can use identity pools only from the same Region. You also must add the following permissions to the IAM policy that is attached to the IAM role that is associated with this identity pool. { "Version": "2012-10-17", "Statement": [ Set up an application to use CloudWatch RUM 1863 Amazon CloudWatch { "Effect": "Allow", "Action": "rum:PutRumEvents", User Guide "Resource": "arn:aws:rum:[region]:[accountid]:appmonitor/[app monitor name]" } ] } Amazon Cognito will then send the necessary security token to enable your application to access CloudWatch RUM. Third-party provider If you choose to use private authentication from a third-party provider, you must get credentials from the identity provider and forward them to AWS. The best way to do this is by using a security token vendor. You can use any security token vendor, including Amazon Cognito with AWS Security Token Service. For more information about AWS STS, see Welcome to the AWS Security Token Service API Reference. If you want to use Amazon Cognito as the token vendor in this scenario, you can configure Amazon Cognito to work with an authentication provider. For more information, see Getting Started with Amazon Cognito Identity Pools (Federated Identities). After you configure Amazon Cognito to work with your identity provider, you also need to do the following: • Create an IAM role with the following permissions. Your application will use this role to access AWS. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "rum:PutRumEvents", "Resource": "arn:aws:rum:[region]:[accountID]:appmonitor/[app monitor name]" } ] } Set up an application to use CloudWatch RUM 1864 Amazon CloudWatch User Guide • Add the following to your application to have it pass the credentials from your provider to CloudWatch RUM. Insert the line so that it runs after a user has signed in to your application and the application has received the credentials to use to access AWS. cwr('setAwsCredentials', {/* Credentials or CredentialProvider */}); For more information about credential providers in the AWS JavaScript SDK, see Setting credentials in a web browser in the v3 developer guide for SDK for JavaScript, Setting credentials in a web browser in the v2 developer guide for SDK for JavaScript, , and @aws-sdk/credential-providers. You can also use the SDK for the CloudWatch RUM web client to configure the web client authentication methods. For more information about the web client SDK, see CloudWatch RUM web client SDK. Creating a CloudWatch RUM app monitor To start using CloudWatch RUM with your application, you create an app monitor. When the app monitor
acw-ug-497
acw-ug.pdf
497
more information about credential providers in the AWS JavaScript SDK, see Setting credentials in a web browser in the v3 developer guide for SDK for JavaScript, Setting credentials in a web browser in the v2 developer guide for SDK for JavaScript, , and @aws-sdk/credential-providers. You can also use the SDK for the CloudWatch RUM web client to configure the web client authentication methods. For more information about the web client SDK, see CloudWatch RUM web client SDK. Creating a CloudWatch RUM app monitor To start using CloudWatch RUM with your application, you create an app monitor. When the app monitor is created, RUM generates a JavaScript snippet for you to paste into your application. The snippet pulls in the RUM web client code. The RUM web client captures data from a percentage of your application's user sessions and sends it to RUM. To create an app monitor 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, RUM. 3. Choose Add app monitor. 4. Enter the information and settings for your application: • For App monitor name, enter a name to be used to identify this app monitor within the CloudWatch RUM console. • For Application domain list, enter the registered domain names where your application has administrative authority. You can also use a wildcard character * to allow any sub-domain or top-level domains (for example, *.amazon.com, amazon.*, *.amazon.*). 5. For Configure RUM data collection, specify whether you want the app monitor to collect each of the following: • Performance telemetry – Collects information about page load and resource load times Set up an application to use CloudWatch RUM 1865 Amazon CloudWatch User Guide • JavaScript errors – Collects information about unhandled JavaScript errors raised by your application You can select Unminify JavaScript error stack traces to debug unminified JavaScript errors. To use this feature, upload your source map files to an Amazon S3 bucket or folder and provide the Amazon S3 URI. Once enabled, RUM will use these source maps and enrich JavaScript error events by adding the unminified stack trace. Note that after enabling, this feature only processes new JavaScript error events and cannot be used on previously collected data. For more information, see Enabling unminification of JavaScript error stack traces. • HTTP errors – Collects information about HTTP errors thrown by your application Selecting these options provides more information about your application, but also generates more CloudWatch RUM events and thus incurs more charges. If you don't select any of these, the app monitor still collects session start events and page IDs so that you can see how many users are using your application, including breakdowns by operating system type and version, browser type and version, device type, and location. 6. Select Check this option to allow the CloudWatch RUM Web Client to set cookies if you want to be able to collect user IDs and session IDs from sampled user sessions. The user IDs are randomly generated by RUM. For more information, see CloudWatch RUM web client cookies (or similar technologies). 7. For Session samples, enter the percentage of user sessions that will be used to gather RUM data. The default is 100%. Reducing this number gives you less data, but reduces your charges. For more information about RUM pricing, see RUM pricing. 8. End user data that you collect for CloudWatch RUM is retained for 30 days and then deleted. If you want to keep copies of RUM events in CloudWatch Logs and configure how long to retain these copies, choose Check this option to store your application telemetry data in your CloudWatch Logs account under Data storage. By default, the CloudWatch Logs log group retains the data for 30 days. You can adjust the retention period in the CloudWatch Logs console. 9. (Optional) Choose to add a resource-based policy to your app monitor to control who can send PutRumEvents requests to your app monitor. If you choose Create public policy, a resource policy will be attached to your app monitor that enables anyone to send PutRumEvents requests to your app monitor. For more information about this method, see Using resource- based policies with CloudWatch RUM. Set up an application to use CloudWatch RUM 1866 Amazon CloudWatch User Guide 10. If you attached a resource-based policy in step 9, then you don't need to sign requests to CloudWatch RUM with AWS credentials, and you can skip setting up authorization. Otherwise, for Authorization, specify whether to use a new or existing Amazon Cognito identity pool or use a different identity provider. Creating a new identity pool is the simplest option that requires no other setup steps. For more information, see see Step 1: Authorize your application to send data to AWS. Creating a new Amazon Cognito identity pool requires administrative permissions.
acw-ug-498
acw-ug.pdf
498
to use CloudWatch RUM 1866 Amazon CloudWatch User Guide 10. If you attached a resource-based policy in step 9, then you don't need to sign requests to CloudWatch RUM with AWS credentials, and you can skip setting up authorization. Otherwise, for Authorization, specify whether to use a new or existing Amazon Cognito identity pool or use a different identity provider. Creating a new identity pool is the simplest option that requires no other setup steps. For more information, see see Step 1: Authorize your application to send data to AWS. Creating a new Amazon Cognito identity pool requires administrative permissions. For more information, see IAM policies to use CloudWatch RUM. 11. (Optional) By default, when you add the RUM code snippet to your application, the web client injects the JavaScript tag to monitor usage into the HTML code of all pages of your application. To change this, choose Configure pages and then choose either Include only these pages or Exclude these pages. Then, specify the pages to include or exclude. To specify a page to include or exclude, enter its complete URLs. To specify additional pages, choose Add URL. 12. To enable AWS X-Ray tracing of the user sessions that are sampled by the app monitor, choose Active tracing and select Trace my service with AWS X-Ray. If you select this, XMLHttpRequest and fetch requests made during user sessions sampled by the app monitor are traced. You can then see traces and segments from these user sessions in the RUM dashboard, and the X-Ray trace map and trace details pages. These user sessions will also show up as client pages in Application Signals after you have enabled it for your application. By making additional configuration changes to the CloudWatch RUM web client, you can add an X-Ray trace header to HTTP requests to enable end-to-end tracing of user sessions through to downstream AWS managed services. For more information, see Enabling X-Ray end-to-end tracing. 13. (Optional) To add tags to the app monitor, choose Tags, Add new tag. Then, for Key, enter a name for the tag. You can add an optional value for the tag in Value. To add another tag, choose Add new tag again. For more information, see Tagging AWS Resources. 14. Choose Add app monitor. Set up an application to use CloudWatch RUM 1867 Amazon CloudWatch User Guide 15. In the Sample code section, you can copy the code snippet to use to add to your application. We recommend that you choose JavaScript or TypeScript and use NPM to install the CloudWatch RUM web client as a JavaScript module. Alternatively, you can choose HTML to use a content delivery network (CDN) to install the CloudWatch RUM web client. The disadvantage of using a CDN is that the web client is often blocked by ad blockers. 16. Choose Copy or Download, and then choose Done. Modifying the code snippet to configure the CloudWatch RUM web client (optional) You can modify the code snippet before inserting it into your application, to activate or deactivate several options. For more information, see the CloudWatch RUM web client documentation. There are four configuration options that you should definitely be aware of, as discussed in these sections. Preventing the collection of resource URLs that might contain personal information By default, the CloudWatch RUM web client is configured to record the URLs of resources downloaded by the application. These resources include HTML files, images, CSS files, JavaScript files, and so on. For some applications, URLs may contain personally identifiable information (PII). If this is the case for your application, we strongly recommend that you disable the collection of resource URLs by setting recordResourceUrl: false in the code snippet configuration, before inserting it into your application. Manually recording page views By default, the web client records page views when the page first loads and when the browser's history API is called. The default page ID is window.location.pathname. However, in some cases you might want to override this behavior and instrument the application to record page views programmatically. Doing so gives you control over the page ID and when it is recorded. For example, consider a web application that has a URI with a variable identifier, such as /entity/123 or /entity/456. By default, CloudWatch RUM generates a page view event for each URI with a distinct page ID matching the pathname, but you might want to group them by the same page ID instead. To accomplish this, disable the web client's page view automation by using the Set up an application to use CloudWatch RUM 1868 Amazon CloudWatch User Guide disableAutoPageView configuration, and use the recordPageView command to set the desired page ID. For more information, see Application-specific Configurations on GitHub. Embedded script example: cwr('recordPageView', { pageId: 'entityPageId' }); JavaScript module example: awsRum.recordPageView({ pageId: 'entityPageId' });
acw-ug-499
acw-ug.pdf
499
such as /entity/123 or /entity/456. By default, CloudWatch RUM generates a page view event for each URI with a distinct page ID matching the pathname, but you might want to group them by the same page ID instead. To accomplish this, disable the web client's page view automation by using the Set up an application to use CloudWatch RUM 1868 Amazon CloudWatch User Guide disableAutoPageView configuration, and use the recordPageView command to set the desired page ID. For more information, see Application-specific Configurations on GitHub. Embedded script example: cwr('recordPageView', { pageId: 'entityPageId' }); JavaScript module example: awsRum.recordPageView({ pageId: 'entityPageId' }); Enabling X-Ray end-to-end tracing When you create the app monitor, selecting Trace my service with AWS X-Ray enables the tracing of XMLHttpRequest and fetch requests made during user sessions that are sampled by the app monitor. You can then see traces from these HTTP requests in the CloudWatch RUM dashboard, and the X-Ray Trace Map and Trace details pages. By default, these client-side traces are not connected to downstream server-side traces. To connect client-side traces to server-side traces and enable end-to-end tracing, set the addXRayTraceIdHeader option to true in the web client. This causes the CloudWatch RUM web client to add an X-Ray trace header to HTTP requests. The following code block shows an example of adding client-side traces. Some configuration options are omitted from this sample for readibility. <script> (function(n,i,v,r,s,c,u,x,z){...})( 'cwr', '00000000-0000-0000-0000-000000000000', '1.0.0', 'us-west-2', 'https://client.rum.us-east-1.amazonaws.com/1.0.2/cwr.js', { enableXRay: true, telemetries: [ 'errors', 'performance', [ 'http', { addXRayTraceIdHeader: true } ] ] } Set up an application to use CloudWatch RUM 1869 Amazon CloudWatch ); </script> Warning User Guide Configuring the CloudWatch RUM web client to add an X-Ray trace header to HTTP requests can cause cross-origin resource sharing (CORS) to fail or invalidate the request's signature if the request is signed with SigV4. For more information, see the CloudWatch RUM web client documentation. We strongly recommend that you test your application before adding a client-side X-Ray trace header in a production environment. For more information, see the CloudWatch RUM web client documentation Sending unsigned requests to CloudWatch RUM By default, the RUM web client signs all requests sent to RUM. If you set signing:false in the client configuration, requests will be unsigned when they are sent to CloudWatch RUM. Data will be ingested to RUM only if there is a public resource based policy attached to the app monitor. For more information, see Using resource-based policies with CloudWatch RUM. Inserting the CloudWatch app monitor code snippet into your application Next, you insert the code snippet that you created in the previous section into your application. Warning The web client, downloaded and configured by the code snippet, uses cookies (or similar technologies) to help you collect end user data. Before you insert the code snippet, see Filtering by metadata attributes in the console. If you don't have the code snippet that was previously generated, you can find it by following the directions in How do I find a code snippet that I've already generated?. To insert the CloudWatch RUM code snippet into your application 1. Insert the code snippet that you copied or downloaded in the previous section inside the <head> element of your application. Insert it before the <body> element or any other <script> tags. Set up an application to use CloudWatch RUM 1870 Amazon CloudWatch User Guide The following is an example of a generated code snippet: <script> (function (n, i, v, r, s, c, x, z) { x = window.AwsRumClient = {q: [], n: n, i: i, v: v, r: r, c: c}; window[n] = function (c, p) { x.q.push({c: c, p: p}); }; z = document.createElement('script'); z.async = true; z.src = s; document.head.insertBefore(z, document.getElementsByTagName('script')[0]); })('cwr', '194a1c89-87d8-41a3-9d1b-5c5cd3dafbd0', '1.0.0', 'us-east-2', 'https://client.rum.us-east-1.amazonaws.com/1.0.2/cwr.js', { sessionSampleRate: 1, identityPoolId: "us-east-2:c90ef0ac-e3b8-4d1a-b313-7e73cfd21443", endpoint: "https://dataplane.rum.us-east-2.amazonaws.com", telemetries: ["performance", "errors", "http"], allowCookies: true, enableXRay: false }); </script> 2. If your application is a multipage web application, you must repeat step 1 for each HTML page that you want included in the data collection. Testing your CloudWatch app monitor setup by generating user events After you have inserted the code snippet and your updated application is running, you can test it by manually generating user events. To test this, we recommend that you do the following. This testing incurs standard CloudWatch RUM charges. • Navigate between pages in your web application. • Create multiple user sessions, using different browsers and devices. • Make requests. Set up an application to use CloudWatch RUM 1871 Amazon CloudWatch • Cause JavaScript errors. User Guide After you have generated some events, view them in the CloudWatch RUM dashboard. For more information, see Viewing the CloudWatch RUM dashboard. Data from user sessions might take up to 15 minutes to appear in the dashboard. If you don't see data 15 minutes after you generated events
acw-ug-500
acw-ug.pdf
500
we recommend that you do the following. This testing incurs standard CloudWatch RUM charges. • Navigate between pages in your web application. • Create multiple user sessions, using different browsers and devices. • Make requests. Set up an application to use CloudWatch RUM 1871 Amazon CloudWatch • Cause JavaScript errors. User Guide After you have generated some events, view them in the CloudWatch RUM dashboard. For more information, see Viewing the CloudWatch RUM dashboard. Data from user sessions might take up to 15 minutes to appear in the dashboard. If you don't see data 15 minutes after you generated events in the application, see Troubleshooting CloudWatch RUM. Using resource-based policies with CloudWatch RUM You can attach a resource policy to a CloudWatch RUM app monitor. By default, app monitors do not have a resource policy attached to them. CloudWatch RUM resource based policies do not support cross-account access. To learn more about AWS resource policies, see Identity-based policies and resource-based policies. To learn more about how resource policies and identity policies are evaluated, see Policy evaluation logic. To learn more about IAM policy grammar, see IAM JSON policy element reference. Supported actions Resource-based policies on app monitors support the rum:PutRumEvents action. Sample policies to use with CloudWatch RUM The following example allows anyone to write data to your app monitor, including those without SigV4 credentials. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "rum:PutRumEvents", "Resource": "arn:aws:rum:region:accountID:appmonitor/app monitor name", "Principal" : "*" } Using resource-based policies with CloudWatch RUM 1872 Amazon CloudWatch ] } User Guide You can modify the policy to block specified source IP addresses by using the aws:SourceIp condition key. With this example, Using this policy, PutRumEvents from the IP address listed will be rejected. All other requests from other IP addresses will be accepted. For more information about this condition key, see Properties of the network in the IAM User Guide. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "rum:PutRumEvents", "Resource": "arn:aws:rum:region:accountID:appmonitor/app monitor name", "Principal" : "*" }, { "Effect": "Deny", "Action": "rum:PutRumEvents", "Resource": "arn:aws:rum:region:accountID:appmonitor/app monitor name", "Principal" : "*", "Condition": { "NotIpAddress": { "aws:SourceIp": "************" } } } ] } Additionally, you can also choose to only accept PutRumEvents requests that are signed with a certain alias using the rum:alias service context key. In the following example, PutRumEvents will have to set the optional Alias request parameter to either alias1 or alias2 for the event to be accepted. To configure your web client to send Alias you must use version 1.20 or later of the CloudWatch RUM web client, as described in Application-specific Configurations on GitHub. { "Version": "2012-10-17", "Statement": [ Using resource-based policies with CloudWatch RUM 1873 Amazon CloudWatch { "Effect": "Allow", "Action": "rum:PutRumEvents", User Guide "Resource": "arn:aws:rum:region:accountID:appmonitor/app monitor name", "Principal" : "*", "Condition": { "StringEquals": { "rum:alias": [ "alias1", "alias2"] } } } ] } Configuring the CloudWatch RUM web client Your applications can use one of the code snippets generated by CloudWatch RUM to install the CloudWatch RUM web client. The generated snippets support two installation methods: as a JavaScript module through NPM, or from a content delivery network (CDN). For best performance, we recommend using the NPM installation method. For more information about using this method, see Installing as a JavaScript Module. If you use the CDN installation option, ad blockers might block the default CDN provided by CloudWatch RUM. This disables application monitoring for users who have ad blockers installed. Because of this, we recommend that you use the default CDN only for initial onboarding with CloudWatch RUM. For more information about the ways to mitigate this issue, see Instrument the application. The code snippet sits in the <head> tag of an HTML file and installs the web client by downloading the web client, and then configuring the web client for the application it is monitoring. The snippet is a self-executing function which looks similar to the following. In this example, the body of the snippet's function has been omitted for readability. <script> (function(n,i,v,r,s,c,u,x,z){...})( 'cwr', '00000000-0000-0000-0000-000000000000', '1.0.0', 'us-west-2', 'https://client.rum.us-east-1.amazonaws.com/1.0.2/cwr.js', { /* Configuration Options Here */ } ); <script> Configuring the CloudWatch RUM web client 1874 Amazon CloudWatch Arguments The code snippet accepts six arguments: User Guide • A namespace for running commands on the web client, such as 'cwr' • The ID of the app monitor, such as '00000000-0000-0000-0000-000000000000' • The application version, such as '1.0.0' • The AWS Region of the app monitor, such as 'us-west-2' • The URL of the web client, such as 'https://client.rum.us- east-1.amazonaws.com/1.0.2/cwr.js' • Application-specific configuration options. For more information, see the following section. Ignoring errors The CloudWatch RUM web client listens to all types of errors that happen in your applications. If your application emits JavaScript errors that you do not want to view in the CloudWatch RUM dashboard, you can configure the
acw-ug-501
acw-ug.pdf
501
for running commands on the web client, such as 'cwr' • The ID of the app monitor, such as '00000000-0000-0000-0000-000000000000' • The application version, such as '1.0.0' • The AWS Region of the app monitor, such as 'us-west-2' • The URL of the web client, such as 'https://client.rum.us- east-1.amazonaws.com/1.0.2/cwr.js' • Application-specific configuration options. For more information, see the following section. Ignoring errors The CloudWatch RUM web client listens to all types of errors that happen in your applications. If your application emits JavaScript errors that you do not want to view in the CloudWatch RUM dashboard, you can configure the CloudWatch RUM web client to filter out these errors so that you see only the relevant error events on the CloudWatch RUM dashboard. For example, you might choose not to view some JavaScript errors in the dashboard because you have already identified a fix for them and the volume of these errors is masking other errors. You might also want to ignore errors that you can't fix because they are owned by a library owned by a third party. For more information about how to instrument the web client to filter out specific JavaScript errors, see the example in Errors in the web client Github documentation. Configuration options For information about the configuration options available for the CloudWatch RUM web client, see the CloudWatch RUM web client documentation Enabling unminification of JavaScript error stack traces When your web application JavaScript source code is minified, error stack traces can be difficult to read. You can enable unminification to the stack traces by uploading your source maps to Amazon S3. CloudWatch RUM will retrieve the source maps to map the line and column numbers in the minified source code back to the original unminified source code. This will improve readability of your error stack traces and help identify the location of the error in the original source code. Enabling unminification of JavaScript error stack traces 1875 Amazon CloudWatch Requirements and syntax User Guide Source maps are crucial for debugging and tracking issues in your web application across different releases. Make sure that each web application release has a unique source map. Each release should have its own unique releaseId. A releaseId must be a string between 1 and 200 characters long and can only contain letters, numbers, underscores, hyphens, colons, forward slashes, and periods. To add the releaseId as metadata to RUM events, configure the CloudWatch RUM web client. Source maps are expected to be plain JSON files following the structure defined by the Source Map V3 specification. The required fields are: version, file, sources, names, and mappings. Make sure the size of each source map does not exceed the limit of 50 MB. In addition, RUM service will only retrieve up to 50 MB of source maps per stack trace. If needed, split the source code into multiple smaller chunks. For more information, see Code Splitting with WebpackJS. Topics • Configure your Amazon S3 bucket resource policy to allow RUM service access • Upload source maps • Configure releaseId in your CloudWatch RUM web client • Enabling CloudWatch RUM app monitor to unminify JavaScript stack traces • Viewing unminified stack traces in the RUM console • Viewing unminified stack traces in CloudWatch Logs • Troubleshooting source maps Configure your Amazon S3 bucket resource policy to allow RUM service access Make sure your Amazon S3 bucket is in the same region as your RUM appMonitor. Configure your Amazon S3 bucket to allow RUM service access for retrieving source map files. Include the aws:SourceArn and aws:SourceAccount global condition context keys to limit the service’s permissions to the resource. This is the most effective way to protect against the confused deputy problem. The following example shows how you can use the aws:SourceArn and aws:SourceAccount global condition context keys in Amazon S3 to prevent the confused deputy problem. { "Version": "2012-10-17", "Statement": [ Enabling unminification of JavaScript error stack traces 1876 User Guide Amazon CloudWatch { "Sid": "RUM Service S3 Read Permissions", "Effect": "Allow", "Principal": { "Service": "rum.amazonaws.com" }, "Action": [ "s3:GetObject", "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::BUCKET_NAME", "arn:aws:s3:::BUCKET_NAME/*" ], "Condition": { "StringEquals": { "aws:SourceAccount": "ACCOUNT_ID", "aws:SourceArn": "arn:aws:rum:REGION:ACCOUNT_ID:appmonitor/APP_MONITOR_NAME" } } } ] } If you are using AWS KMS keys to encrypt the data, make sure the key’s resource policy is configured similarly to include the aws:SourceArn and aws:SourceAccount global condition context keys to give RUM service access to use the keys to retrieve the source map files. { "Version": "2012-10-17", "Statement": [ { "Sid": "RUM Service KMS Read Permissions", "Effect": "Allow", "Principal": { "Service": "rum.amazonaws.com" }, "Action": "kms:Decrypt", "Resource": "arn:aws:kms:REGION:ACCOUNT_ID:key/KEY_ID", "Condition": { "StringEquals": { "aws:SourceAccount": "ACCOUNT_ID", Enabling unminification of JavaScript error stack traces 1877 Amazon CloudWatch User Guide "aws:SourceArn": "arn:aws:rum:REGION:ACCOUNT_ID/APP_MONITOR_NAME" } } } ] } Upload source maps Configure your JavaScript bundle to generate source
acw-ug-502
acw-ug.pdf
502
using AWS KMS keys to encrypt the data, make sure the key’s resource policy is configured similarly to include the aws:SourceArn and aws:SourceAccount global condition context keys to give RUM service access to use the keys to retrieve the source map files. { "Version": "2012-10-17", "Statement": [ { "Sid": "RUM Service KMS Read Permissions", "Effect": "Allow", "Principal": { "Service": "rum.amazonaws.com" }, "Action": "kms:Decrypt", "Resource": "arn:aws:kms:REGION:ACCOUNT_ID:key/KEY_ID", "Condition": { "StringEquals": { "aws:SourceAccount": "ACCOUNT_ID", Enabling unminification of JavaScript error stack traces 1877 Amazon CloudWatch User Guide "aws:SourceArn": "arn:aws:rum:REGION:ACCOUNT_ID/APP_MONITOR_NAME" } } } ] } Upload source maps Configure your JavaScript bundle to generate source maps during minification. When you build your application, the bundle will create a directory (for example, dist) containing the minified JavaScript files and their corresponding source maps. See below for an example. ./dist |-index.d5a07c87.js |-index.d5a07c87.js.map Upload the source map files to your Amazon S3 bucket. The files should be located in a folder with the releaseId as the name. For example, if my bucket name is my-application-source-maps and the releaseId is 2.0.0, then the source map file is located at the following location: my-application-source-maps |-2.0.0 |-index.d5a07c87.js.map To automate uploading your source maps, you can create the following bash script and execute it as part of your build process. #!/bin/bash # Ensure the script is called with required arguments if [ "$#" -ne 2 ]; then echo "Usage: $0 S3_BUCKET_NAME RELEASE_ID" exit 1 fi # Read arguments S3_BUCKET="$1" RELEASE_ID="$2" # Set the path to your build directory BUILD_DIR="./dist" Enabling unminification of JavaScript error stack traces 1878 Amazon CloudWatch User Guide # Upload all .map files recursively if aws s3 cp "$BUILD_DIR" "s3://$S3_BUCKET/$RELEASE_ID/" --recursive --exclude "*" -- include "*.map"; then echo "Successfully uploaded all source map files" else echo "Failed to upload source map files" fi Configure releaseId in your CloudWatch RUM web client CloudWatch RUM uses the configured releaseId to determine the folder to retrieve the source map files. Name the releaseId the same as your source map files folder. If you used the provided bash script above or a similar one, the releaseId configured in the script should be the same as the one configured in your CloudWatch RUM web client. You must use version 1.21.0 or later of the CloudWatch RUM web client. import { AwsRum, AwsRumConfig } from "aws-rum-web"; try { const config: AwsRumConfig = { sessionSampleRate: 1, endpoint: "https://dataplane.rum.us-west-2.amazonaws.com", telemetries: ["performance", "errors", "http"], allowCookies: true, releaseId: "RELEASE_ID", //Add this }; const APPLICATION_ID: string = "APP_MONITOR_ID"; const APPLICATION_VERSION: string = "1.0.0"; const APPLICATION_REGION: string = "us-west-2"; new AwsRum(APPLICATION_ID, APPLICATION_VERSION, APPLICATION_REGION, config); } catch (error: any) { // Ignore errors thrown during CloudWatch RUM web client initialization } Enabling CloudWatch RUM app monitor to unminify JavaScript stack traces To unminify JavaScript stack traces, set the app monitor's SourceMap status to ENABLED. Provide the Amazon S3 URI to the bucket or folder containing all source maps for your app monitor. Enabling unminification of JavaScript error stack traces 1879 Amazon CloudWatch User Guide When storing source maps directly in the main bucket (not in a subfolder), then the Amazon S3 URI should be formatted as Amazon S3://BUCKET_NAME. In this case, source map files should be located at the following location. BUCKET_NAME |- RELEASE_ID |-index.d5a07c87.js.map When a child directory is the root, then the Amazon S3 URI should be formatted as Amazon S3://BUCKET_NAME/DIRECTORY. In this case, source map files should be located at the following location. BUCKET_NAME |- DIRECTORY |-RELEASE_ID |-index.d5a07c87.js.map Viewing unminified stack traces in the RUM console After uploading your source maps to Amazon S3, enabling source maps on your RUM app monitor, and deploying your web application with the releaseId configured in the CloudWatch RUM web client, select Events in the RUM console. This tab displays the raw RUM event data. Filter by the JS error event type and view the latest JS error event. You will see the unminified stack trace in the new event_details.unminifiedStack field for events ingested after the feature was enabled. Viewing unminified stack traces in CloudWatch Logs Enable RUM event storage in CloudWatch Logs by turning on Data storage. Once enabled, you can search the new event_details.unminifiedStack field. This allows you to analyze trends and relate issues across multiple sessions using CloudWatch Logs queries. Troubleshooting source maps CloudWatch RUM provides out of the box metrics to troubleshoot your source map setup. These metrics are published in the metric namespace named AWS/RUM. The following metrics are published with an application_name dimension. The value of this dimension is the name of the app monitor. The metrics are also published with an aws:releaseId dimension. The value of this dimension is the releaseId associated with the JavaScript error event. Enabling unminification of JavaScript error stack traces 1880 Amazon CloudWatch User Guide MetricName Unit Description UnminifyLineFailureCount Count UnminifyLineSuccessCount Count UnminifyEventFailureCount Count UnminifyEventSuccessCount Count The count of stack trace lines
acw-ug-503
acw-ug.pdf
503
Troubleshooting source maps CloudWatch RUM provides out of the box metrics to troubleshoot your source map setup. These metrics are published in the metric namespace named AWS/RUM. The following metrics are published with an application_name dimension. The value of this dimension is the name of the app monitor. The metrics are also published with an aws:releaseId dimension. The value of this dimension is the releaseId associated with the JavaScript error event. Enabling unminification of JavaScript error stack traces 1880 Amazon CloudWatch User Guide MetricName Unit Description UnminifyLineFailureCount Count UnminifyLineSuccessCount Count UnminifyEventFailureCount Count UnminifyEventSuccessCount Count The count of stack trace lines in the JS error event that failed to be unminified. Additional details regarding the failure will be added to the specific line that failed in the event_details.unmi nifiedStack field. The count of stack trace lines in the JS error event that were successfully unminified. The count of JS error events that failed to have any lines unminified. Additional details regarding the failure will be added in the event_det ails.unminifiedStack field. The count of JS error events that succeeded to have at least one stack trace line unminified. CloudWatch RUM may fail to unminify a line in the stack trace for various reasons, including but not limited to: • Failure to retrieve corresponding source map file due to permission issues. Make sure the bucket resource policy is configured correctly. • Corresponding source map file does not exist. Make sure the source map files have been uploaded to the correct bucket or folder that has the same name as the releaseId configured in your CloudWatch RUM web client. • Corresponding source map file is too big. Split your source code into smaller chunks. Enabling unminification of JavaScript error stack traces 1881 Amazon CloudWatch User Guide • 50 MB worth of source map files already retrieved for the stack trace. Reduce the stack trace length as 50 MB is service side limitation. • Source map is invalid and could not be indexed. Make sure the source map is a plain JSON following the structure defined by the Source Map V3 specification and includes the following fields: version, file, sources, names, mappings. • Source map could not map the minified source code back to the unminified stack trace. Make sure the source map is the correct source map for the given releaseId. Regionalization This section illustrates strategies for using CloudWatch RUM with applications in different Regions. My web application is deployed in multiple AWS Regions If your web application is deployed in multipled AWS Regions, you have three options: • Deploy one app monitor in one Region, in one account, serving all Regions. • Deploy separate app monitors for each Region, in unique accounts. • Deploy separate app monitors for each Region, all in one account. The advantage of using one app monitor is that all data will be centralized into one visualization, and all logs are written to the same log group in CloudWatch Logs. With a single app monitor there is a small amount of extra latency for requests, and a single point of failure. Using multiple app monitors removes the single point of failure, but prevents all data from being combined into one visualization. CloudWatch RUM hasn't launched in some Regions that my application is deployed in CloudWatch RUM is launched into many Regions and has wide geographical coverage. By setting up CloudWatch RUM in the Regions where it is available, you can get the benefits. End users can be anywhere and still have their sessions included if you have set up an app monitor in the Region that they are connecting to. However, CloudWatch RUM is not yet launched in AWS GovCloud (US-East), AWS GovCloud (US- West), or any Regions in China. You are not able to send data to CloudWatch RUM from these Regions. Regionalization 1882 Amazon CloudWatch Use page groups User Guide Use page groups to associate different pages in your application with each other so that you can see aggregated analytics for groups of pages. For example, you might want to see the aggregated page load times of all of your landing pages. You put pages into page groups by adding one or more tags to page view events in the CloudWatch RUM web client. The following examples put the /home page into the page group named en and the page group named landing. Embedded script example cwr('recordPageView', { pageId: '/home', pageTags: ['en', 'landing']}); JavaScript module example awsRum.recordPageView({ pageId: '/home', pageTags: ['en', 'landing']}); Note Page groups are intended to facilitate aggregating analytics across different pages. For information about how to define and manipulate pageIds for your application, see the Manually recording page views section in Modifying the code snippet to configure the CloudWatch RUM web client (optional). Specify custom metadata CloudWatch RUM attaches additional data to each
acw-ug-504
acw-ug.pdf
504
view events in the CloudWatch RUM web client. The following examples put the /home page into the page group named en and the page group named landing. Embedded script example cwr('recordPageView', { pageId: '/home', pageTags: ['en', 'landing']}); JavaScript module example awsRum.recordPageView({ pageId: '/home', pageTags: ['en', 'landing']}); Note Page groups are intended to facilitate aggregating analytics across different pages. For information about how to define and manipulate pageIds for your application, see the Manually recording page views section in Modifying the code snippet to configure the CloudWatch RUM web client (optional). Specify custom metadata CloudWatch RUM attaches additional data to each event as metadata. Event metadata consists of attributes in the form of key-value pairs. You can use these attributes to search or filter events in the CloudWatch RUM console. By default, CloudWatch RUM creates some metadata for you. For more information about the default metadata, see RUM event metadata. You can also use the CloudWatch RUM web client to add custom metadata to CloudWatch RUM events. The custom metadata can include session attributes and page attributes. To add custom metadata, you must use version 1.10.0 or later of the CloudWatch RUM web client. Use page groups 1883 Amazon CloudWatch Requirements and syntax User Guide Each event can include as many as 10 custom attributes in the metadata. The syntax requirements for custom attributes are as follows: • Keys • Maximum of 128 characters • Can include alphanumeric characters, colons (:), and underscores (_) • Can't begin with aws:. • Can't consist entirely of any of the reserved keywords listed in the following section. Can use those keywords as part of a longer key name. • Values • Maximum of 256 characters • Must be strings, numbers, or Boolean values Reserved keywords You can't use the following reserved keywords as complete key names. You can use the following keywords as part of a longer key name, such as applicationVersion. • browserLanguage • browserName • browserVersion • countryCode • deviceType • domain • interaction • osName • osVersion • pageId • pageTags • pageTitle • pageUrl Specify custom metadata 1884 User Guide Amazon CloudWatch • parentPageId • platformType • referrerUrl • subdivisionCode • title • url • version Note CloudWatch RUM removes custom attributes from RUM events if an attribute includes a key or value that is not valid, or if the limit of 10 custom attributes per event has already been reached. Add session attributes If you configure custom session attributes, they are added to all events in a session. You configure session attributes either during CloudWatch RUM web client initialization or at runtime by using the addSessionAttributes command. For example, you can add your application’s version as a session attribute. Then, in the CloudWatch RUM console, you can filter errors by version to find whether an increased error rate is associated with a particular version of your application. Adding a session attribute at initialization, NPM example The code section in bold adds the session attribute. import { AwsRum, AwsRumConfig } from 'aws-rum-web'; try { const config: AwsRumConfig = { allowCookies: true, endpoint: "https://dataplane.rum.us-west-2.amazonaws.com", guestRoleArn: "arn:aws:iam::000000000000:role/RUM-Monitor-us- west-2-000000000000-00xx-Unauth", Specify custom metadata 1885 Amazon CloudWatch User Guide identityPoolId: "us-west-2:00000000-0000-0000-0000-000000000000", sessionSampleRate: 1, telemetries: ['errors', 'performance'], sessionAttributes: { applicationVersion: "1.3.8" } }; const APPLICATION_ID: string = '00000000-0000-0000-0000-000000000000'; const APPLICATION_VERSION: string = '1.0.0'; const APPLICATION_REGION: string = 'us-west-2'; const awsRum: AwsRum = new AwsRum( APPLICATION_ID, APPLICATION_VERSION, APPLICATION_REGION, config ); } catch (error) { // Ignore errors thrown during CloudWatch RUM web client initialization } Adding a session attribute at runtime, NPM example awsRum.addSessionAttributes({ applicationVersion: "1.3.8" }) Adding a session attribute at initialization, embedded script example The code section in bold adds the session attribute. <script> (function(n,i,v,r,s,c,u,x,z){...})( 'cwr', '00000000-0000-0000-0000-000000000000', '1.0.0', 'us-west-2', 'https://client.rum.us-east-1.amazonaws.com/1.0.2/cwr.js', { sessionSampleRate:1, guestRoleArn:'arn:aws:iam::000000000000:role/RUM-Monitor-us- west-2-000000000000-00xx-Unauth', Specify custom metadata 1886 Amazon CloudWatch User Guide identityPoolId:'us-west-2:00000000-0000-0000-0000-000000000000', endpoint:'https://dataplane.rum.us-west-2.amazonaws.com', telemetries:['errors','http','performance'], allowCookies:true, sessionAttributes: { applicationVersion: "1.3.8" } } ); </script> Adding a session attribute at runtime, embedded script example <script> function addSessionAttribute() { cwr('addSessionAttributes', { applicationVersion: "1.3.8" }) } </script> Add page attributes If you configure custom page attributes, they are added to all events on the current page. You configure page attributes either during CloudWatch RUM web client initialization or at runtime by using the recordPageView command. For example, you can add your page template as a page attribute. Then, in the CloudWatch RUM console, you can filter errors by page templates to find whether an increased error rate is associated with a particular page template of your application. Adding a page attribute at initialization, NPM example The code section in bold adds the page attribute. const awsRum: AwsRum = new AwsRum( APPLICATION_ID, APPLICATION_VERSION, APPLICATION_REGION, { disableAutoPageView: true // optional } ); Specify custom metadata 1887 Amazon CloudWatch User Guide awsRum.recordPageView({ pageId:'/home', pageAttributes: { template: 'artStudio' } }); const credentialProvider = new CustomCredentialProvider(); if(awsCreds) awsRum.setAwsCredentials(credentialProvider); Adding a page attribute at
acw-ug-505
acw-ug.pdf
505
can add your page template as a page attribute. Then, in the CloudWatch RUM console, you can filter errors by page templates to find whether an increased error rate is associated with a particular page template of your application. Adding a page attribute at initialization, NPM example The code section in bold adds the page attribute. const awsRum: AwsRum = new AwsRum( APPLICATION_ID, APPLICATION_VERSION, APPLICATION_REGION, { disableAutoPageView: true // optional } ); Specify custom metadata 1887 Amazon CloudWatch User Guide awsRum.recordPageView({ pageId:'/home', pageAttributes: { template: 'artStudio' } }); const credentialProvider = new CustomCredentialProvider(); if(awsCreds) awsRum.setAwsCredentials(credentialProvider); Adding a page attribute at runtime, NPM example awsRum.recordPageView({ pageId: '/home', pageAttributes: { template: 'artStudio' } }); Adding a page attribute at initialization, embedded script example The code section in bold adds the page attribute. <script> (function(n,i,v,r,s,c,u,x,z){...})( 'cwr', '00000000-0000-0000-0000-000000000000', '1.0.0', 'us-west-2', 'https://client.rum.us-east-1.amazonaws.com/1.0.2/cwr.js', { disableAutoPageView: true //optional } ); cwr('recordPageView', { pageId: '/home', pageAttributes: { template: 'artStudio' } }); const awsCreds = localStorage.getItem('customAwsCreds'); if(awsCreds) cwr('setAwsCredentials', awsCreds) </script> Specify custom metadata 1888 Amazon CloudWatch User Guide Adding a page attribute at runtime, embedded script example <script> function recordPageView() { cwr('recordPageView', { pageId: '/home', pageAttributes: { template: 'artStudio' } }); } </script> Filtering by metadata attributes in the console To filter the visualizations in the CloudWatch RUM console with any built-in or custom metadata attribute, use the search bar. In the search bar, you can specify as many as 20 filter terms in the form of key=value to apply to the visualizations. For example, to filter data for only the Chrome browser, you could add the filter term browserName=Chrome. By default, the CloudWatch RUM console retrieves the 100 most common attributes keys and values to display in the dropdown in the search bar. To add more metadata attributes as filter terms, enter the complete attribute key and value into the search bar. A filter can include as many as 20 filter terms, and you can save up to 20 filters per app monitor. When you save a filter, it is saved in the Saved filters dropdown. You can also delete a saved filter. Send custom events CloudWatch RUM records and ingests the events listed in Information collected by the CloudWatch RUM web client. If you use version 1.12.0 or later of the CloudWatch RUM web client, you can define, record, and send additional custom events. You define the event type name and the data to send for each event type that you define. Each custom event payload can be up to 6 KB. Custom events are ingested only if the app monitor has custom events enabled. To update the configuration settings of your app monitor, use the CloudWatch RUM console or the UpdateAppMonitor API. After you enable custom events, and then define and send custom events, you can search for them. To search for them, use the Events tab in the CloudWatch RUM console. Search by using the event type. Send custom events 1889 Amazon CloudWatch Requirements and syntax User Guide Custom events consist of an event type and event details. The requirements for these are as follows: • Event type • This can be either the type or name of your event. For example, the CloudWatch RUM built-in event type called JsError has an event type of com.amazon.rum.js_error_event. • Must be between 1 and 256 characters. • Can be a combination of alphanumeric characters, underscores, hyphens, and periods. • Event details • Contains the actual data that you want to record in CloudWatch RUM. • Must be an object that consists of fields and values. Examples of recording custom events There are two ways to record custom events in the CloudWatch RUM web client. • Use the CloudWatch RUM web client's recordEvent API. • Use a customized plugin. Send a custom event using the recordEvent API, NPM example awsRum.recordEvent('my_custom_event', { location: 'IAD', current_url: 'amazonaws.com', user_interaction: { interaction_1 : "click", interaction_2 : "scroll" }, visit_count:10 } ) Send a custom event using the recordEvent API, embedded script example cwr('recordEvent', { type: 'my_custom_event', Send custom events 1890 Amazon CloudWatch data: { location: 'IAD', current_url: 'amazonaws.com', user_interaction: { interaction_1 : "click", interaction_2 : "scroll" }, visit_count:10 } }) User Guide Example of sending a custom event using a customized plugin // Example of a plugin that listens to a scroll event, and // records a 'custom_scroll_event' that contains the timestamp of the event. class MyCustomPlugin implements Plugin { // Initialize MyCustomPlugin. constructor() { this.enabled; this.context; this.id = 'custom_event_plugin'; } // Load MyCustomPlugin. load(context) { this.context = context; this.enable(); } // Turn on MyCustomPlugin. enable() { this.enabled = true; this.addEventHandler(); } // Turn off MyCustomPlugin. disable() { this.enabled = false; this.removeEventHandler(); } // Return MyCustomPlugin Id. getPluginId() { return this.id; } // Record custom event. record(data) { Send custom events 1891 Amazon CloudWatch User Guide this.context.record('custom_scroll_event', data); } // EventHandler. private
acw-ug-506
acw-ug.pdf
506
// Example of a plugin that listens to a scroll event, and // records a 'custom_scroll_event' that contains the timestamp of the event. class MyCustomPlugin implements Plugin { // Initialize MyCustomPlugin. constructor() { this.enabled; this.context; this.id = 'custom_event_plugin'; } // Load MyCustomPlugin. load(context) { this.context = context; this.enable(); } // Turn on MyCustomPlugin. enable() { this.enabled = true; this.addEventHandler(); } // Turn off MyCustomPlugin. disable() { this.enabled = false; this.removeEventHandler(); } // Return MyCustomPlugin Id. getPluginId() { return this.id; } // Record custom event. record(data) { Send custom events 1891 Amazon CloudWatch User Guide this.context.record('custom_scroll_event', data); } // EventHandler. private eventHandler = (scrollEvent: Event) => { this.record({timestamp: Date.now()}) } // Attach an eventHandler to scroll event. private addEventHandler(): void { window.addEventListener('scroll', this.eventHandler); } // Detach eventHandler from scroll event. private removeEventHandler(): void { window.removeEventListender('scroll', this.eventHandler); } } Viewing the CloudWatch RUM dashboard CloudWatch RUM helps you collect data from user sessions about your application's performance, including page load times, Apdex score, browsers and devices used, geolocation of user sessions, and sessions with errors. All of this information is displayed in a dashboard. To view the RUM dashboard 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, RUM. The Overview tab displays information collected by one of the app monitors that you have created. The top row of panes displays the following information for this app monitor: • Number of page loads • Average page load speed • Apdex score • Status of any alarms associated with the app monitor The application performance index (Apdex) score indicates end users' level of satisfaction. Scores range from 0 (least satisfied) to 1 (most satisfied). The scores are based on application Viewing the CloudWatch RUM dashboard 1892 Amazon CloudWatch User Guide performance only. Users are not asked to rate the application. For more information about Apdex scores, see How CloudWatch RUM sets Apdex scores. Several of these panes include links that you can use to further examine the data. Choosing any of these links displays a detailed view with Performance, Errors, HTTP requests, Sessions, Events Browsers & Devices, and User Journey tabs at the top of the display. 3. To focus further, choose the List view tab and then choose the name of the app monitor that you want to focus on. This displays the following tabs for the chosen app monitor. • The Performance tab displays page performance information including load times, request information, web vitals, and page loads over time. This view features interactive web vitals graphs where you can see the different percentile values of core web vitals for your pages and choose datapoints on the graph to view associated events captured by CloudWatch RUM. From there, you can either explore more events related to the metric spike or view page details for a selected event to identify specific conditions causing performance issues. On this tab you can also toggle the view between Page loads, Requests, and Location to see more details about page performance. • The Errors tab displays Javascript error information including the error message most frequently seen by users and the devices and browsers with the most errors. This view includes a histogram of the errors and a list view of errors. You can filter the list of errors by user and event details. Choose an error message to see more details. • The HTTP requests tab displays HTTP request information including the request URL with most errors and the devices and browsers with the most errors. This tab includes a histogram of the requests, a list view of requests, and a list view of network errors. You can filter the lists by user and event details. Choose a response code or an error message to s ee more details about the request or network error, respectively. • The Sessions tab displays session metrics. This tab includes a histogram of session start events and a list view of sessions. You can filter the list of sessions by event type, user details, and event details. Choose a sessionId to see more details about a session. • The Events tab displays a histogram of RUM events and a list view of the events. You can filter the list of events by event type, user details, and event details. Choose a RUM event to see the raw event. • The Browsers & Devices tab displays information such as the performance and usage of different browsers and devices to access your application. This view includes controls to toggle the view between focusing on Browsers and Devices. Viewing the CloudWatch RUM dashboard 1893 Amazon CloudWatch User Guide If you narrow the scope to a single browser, you see the data broken down by browser version. • The User Journey tab displays the paths that your customers use
acw-ug-507
acw-ug.pdf
507
can filter the list of events by event type, user details, and event details. Choose a RUM event to see the raw event. • The Browsers & Devices tab displays information such as the performance and usage of different browsers and devices to access your application. This view includes controls to toggle the view between focusing on Browsers and Devices. Viewing the CloudWatch RUM dashboard 1893 Amazon CloudWatch User Guide If you narrow the scope to a single browser, you see the data broken down by browser version. • The User Journey tab displays the paths that your customers use to navigate your application. You can see where your customers enter your application and what page they exit your application from. You can also see the paths that they take and the percentage of customers that follow those paths. You can pause on a node to get more details about that page. You can choose a single path to highlight the connections for easier viewing. 4. (Optional) On any of the first six tabs, you can choose the Pages button and select a page or page group from the list. This narrows down the displayed data to a single page or group of pages of your application. You can also mark pages and page groups in the list as favorites. How CloudWatch RUM sets Apdex scores Apdex (Application Performance Index) is an open standard that defines a method to report, benchmark, and rate application response time. An Apdex score helps you understand and identify the impact on application performance over time. The Apdex score indicates the end users' level of satisfaction Scores range from 0 (least satisfied) to 1 (most satisfied). The scores are based on application performance only. Users are not asked to rate the application. Each individual Apdex score falls into one of three thresholds. Based on the Apdex threshold and actual application response time, there are three kinds of performance, as follows: • Satisfied– The actual application response time is less than or equal to the Apdex threshold. For CloudWatch RUM, this threshold is 2000 ms or less. • Tolerable– The actual application response time is greater than the Apdex threshold, but less than or equal to four times the Apdex threshold. For CloudWatch RUM, this range is 2000–8000 ms. • Frustrating– The actual application response time is greater than four times the Apdex threshold. For CloudWatch RUM, this range is over 8000 ms. The total 0-1 Apdex score is calculated using the following formula: (positive scores + tolerable scores/2)/total scores * 100 Viewing the CloudWatch RUM dashboard 1894 Amazon CloudWatch User Guide CloudWatch metrics that you can collect with CloudWatch RUM The table in this section lists the metrics that you automatically collect with CloudWatch RUM. You can see these metrics in the CloudWatch console. For more information, see View available metrics. You can also optionally send extended metrics to CloudWatch or CloudWatch Evidently. For more information, see Extended metrics. These metrics are published in the metric namespace named AWS/RUM. All of the following metrics are published with an application_name dimension. The value of this dimension is the name of the app monitor. Some metrics are also published with additional dimensions, as listed in the table. Metric HttpStatusCodeCount Unit Count Http4xxCount Count Description The count of HTTP responses in the application, by their response status code. Additional dimension s: • event_det ails.resp onse.status is the response status code, such as 200, 400, 404, and so on. • event_type The type of event. Currently, the only possible value for this dimension is http. The count of HTTP responses in the CloudWatch metrics that you can collect with CloudWatch RUM 1895 Amazon CloudWatch Metric Unit Description User Guide Http4xxCountPerSession Count Http4xxCountPerPageView Count Http5xxCount Count application, with 4xx response status code. These are calculated based on http_even t RUM events that result in 4xx codes. The count of HTTP responses in a session, with 4xx response status code. These are calculated based on http_even t RUM events that result in 4xx codes. The count of HTTP responses in a page review, with 4xx response status code. These are calculated based on http_even t RUM events that result in 4xx codes. The count of HTTP responses in the application, with 5xx response status code. These are calculated based on http_even t RUM events that result in 5xx codes. CloudWatch metrics that you can collect with CloudWatch RUM 1896 Amazon CloudWatch Metric Http5xxCountPerSession Unit Count Http5xxCountPerPageView Count JsErrorCount Count JsErrorCountPerSession Count JsErrorCountPerPageView Count User Guide Description The count of HTTP responses in the session, with 5xx response status code. These are calculated based on http_even t RUM events that result in 5xx codes. The count of HTTP responses in a page review, with 5xx response status code. These are calculated based
acw-ug-508
acw-ug.pdf
508
codes. The count of HTTP responses in the application, with 5xx response status code. These are calculated based on http_even t RUM events that result in 5xx codes. CloudWatch metrics that you can collect with CloudWatch RUM 1896 Amazon CloudWatch Metric Http5xxCountPerSession Unit Count Http5xxCountPerPageView Count JsErrorCount Count JsErrorCountPerSession Count JsErrorCountPerPageView Count User Guide Description The count of HTTP responses in the session, with 5xx response status code. These are calculated based on http_even t RUM events that result in 5xx codes. The count of HTTP responses in a page review, with 5xx response status code. These are calculated based on http_even t RUM events that result in 5xx codes. The count of JavaScript error events ingested. The count of JavaScript error events ingested in a session. The count of JavaScript error events ingested in a page review. CloudWatch metrics that you can collect with CloudWatch RUM 1897 Amazon CloudWatch Metric Unit Description User Guide NavigationFrustratedTransaction Count NavigationSatisfiedTransaction Count The count of navigation events with a duration higher than the frustrating threshold, which is 8000ms. The duration of navigatio n events is tracked in the Performan ceNavigat ionDuration metric. The count of navigation events with a duration that is less than the Apdex objective, which is 2000ms. The duration of navigatio n events is tracked in the Performan ceNavigat ionDuration metric. CloudWatch metrics that you can collect with CloudWatch RUM 1898 Amazon CloudWatch Metric NavigationToleratedTransaction Unit Count PageViewCount Count PageViewCountPerSession Count User Guide Description The count of navigation events with a duration between 2000ms and 8000ms. The duration of navigatio n events is tracked in the Performan ceNavigat ionDuration metric. The count of page view events ingested by the app monitor. This is calculate d by counting the page_view_event RUM events. The count of page view events in a session. CloudWatch metrics that you can collect with CloudWatch RUM 1899 Amazon CloudWatch Metric Unit Description User Guide PerformanceResourceDuration Milliseconds PerformanceNavigationDuration Milliseconds RumEventPayloadSize Bytes The duration of a resource event. Additional dimension s: • event_det ails.file .type is the file type of the resource event, such as a styleshee t, document, image, script, or font. • event_type The type of event. Currently, the only possible value for this dimension is resource. The duration of a navigation event. The size of every event ingested by CloudWatch RUM. You can also use the SampleCou nt statistic for this metric to monitor the number of events that an app monitor is ingesting. CloudWatch metrics that you can collect with CloudWatch RUM 1900 Amazon CloudWatch Metric SessionCount Unit Count SessionDuration Milliseconds TimeOnPage Milliseconds WebVitalsCumulativeLayoutShift None WebVitalsFirstInputDelay Milliseconds User Guide Description The count of session start events ingested by the app monitor. In other words, the number of new sessions started. The duration of a session. These are calculated based on the time between first and last events in a session. The duration of a page view. These are calculate d based on the time until next page view, except for the final page in a session where it's the time between first and last events on that page. Tracks the value of the cumulative layout shift events. Tracks the value of the first input delay events. CloudWatch metrics that you can collect with CloudWatch RUM 1901 Amazon CloudWatch Metric Unit Description User Guide WebVitalsLargestContentfulPaint Milliseconds WebVitalsInteractionToNextPaint Milliseconds Tracks the value of the largest contentful paint events. Tracks the value of the interaction to next paint events. Custom metrics and extended metrics that you can send to CloudWatch and CloudWatch Evidently By default, RUM app monitors send metrics to CloudWatch. These default metrics and dimensions are listed in CloudWatch metrics that you can collect with CloudWatch RUM. You can also set up an app monitor to export metric. The app monitor can send extended metrics, custom metrics, or both. It can send them to CloudWatch or to CloudWatch Evidently, or to both. • Custom metrics– Custom metrics are metrics that you define. With custom metrics, you can use any metric name and namespace. To derive the metrics, you can use any custom events, built-in events, custom attributes, or default attributes. You can send custom metrics to both CloudWatch and CloudWatch Evidently. • Extended metrics– Lets you send the default CloudWatch RUM metrics to CloudWatch Evidently to be used in Evidently experiments. You can also send any of the default CloudWatch RUM metrics to CloudWatch with additional dimensions. This way, these metrics can give you a more fine-grained view. Topics • Custom metrics • Extended metrics CloudWatch metrics that you can collect with CloudWatch RUM 1902 Amazon CloudWatch Custom metrics User Guide To send custom metrics, you must use the AWS APIs or AWS CLI instead of the console. For more information about using the AWS APIs, see PutRumMetricsDestination and BatchCreateRumMetricDefinitions. The maximum number of extended metric
acw-ug-509
acw-ug.pdf
509
send the default CloudWatch RUM metrics to CloudWatch Evidently to be used in Evidently experiments. You can also send any of the default CloudWatch RUM metrics to CloudWatch with additional dimensions. This way, these metrics can give you a more fine-grained view. Topics • Custom metrics • Extended metrics CloudWatch metrics that you can collect with CloudWatch RUM 1902 Amazon CloudWatch Custom metrics User Guide To send custom metrics, you must use the AWS APIs or AWS CLI instead of the console. For more information about using the AWS APIs, see PutRumMetricsDestination and BatchCreateRumMetricDefinitions. The maximum number of extended metric and custom metric definitions that one destination can contain is 2000. For each custom metric or extended metric that you send to each destination, each combination of dimension name and dimension value counts toward this limit. You are not charged for custom metrics derived from any kind of events or attributes of CloudWatch RUM. The following example shows how to create a custom metric derived from a custom event. Here is the example custom event that is used: cwr('recordEvent', { type: 'my_custom_event', data: { location: 'IAD', current_url: 'amazonaws.com', user_interaction: { interaction_1 : "click", interaction_2 : "scroll" }, visit_count:10 } }) Given this custom event, you can create a custom metric that counts the number of visits to the amazonaws.com URL from Chrome browsers. The following definition creates a metric named AmazonVisitsCount in your account, in the RUM/CustomMetrics/PageVisits namespace. { "AppMonitorName":"customer-appMonitor-name", "Destination":"CloudWatch", "MetricDefinitions":[ { "Name":"AmazonVisitsCount", "Namespace":"PageVisit", "ValueKey":"event_details.visit_count", "UnitLabel":"Count", "DimensionKeys":{ "event_details.current_url": "URL" CloudWatch metrics that you can collect with CloudWatch RUM 1903 Amazon CloudWatch }, User Guide "EventPattern":"{\"metadata\":{\"browserName\":[\"Chrome\"]},\"event_type \":[\"my_custom_event\"],\"event_details\": {\"current_url\": [\"amazonaws.com\"]}}" } ] } Extended metrics If you set up extended metrics, you can do one or both of the following: • Send default CloudWatch RUM metrics to CloudWatch Evidently to be used in Evidently experiments. Only the PerformanceNavigationDuration, PerformanceResourceDuration, WebVitalsCumulativeLayoutShift, WebVitalsFirstInputDelay, and WebVitalsLargestContentfulPaint metrics can be sent to Evidently. • Send any of the default CloudWatch RUM metrics to CloudWatch with additional dimensions so that the metrics give you a more fine-grained view. For example, you can see metrics specific to a certain browser that's used by your users, or metrics for users in a specific geolocation. For more information about the default CloudWatch RUM metrics, see CloudWatch metrics that you can collect with CloudWatch RUM. The maximum number of extended metric and custom metric definitions that one destination can contain is 2000. For each extended or custom metric that you send to each destination, each combination of dimension name and dimension value counts as an extended metric for this limit. When you send extended metrics to CloudWatch, you can use the CloudWatch RUM console to create CloudWatch alarms on them. You are not charged for extended metrics that are created for the default metrics of CloudWatch RUM. The following dimensions are supported for extended metrics for all the metric names that app monitors can send. These metric names are listed in CloudWatch metrics that you can collect with CloudWatch RUM. • BrowserName Example dimension values: Chrome, Firefox, Chrome Headless • CountryCode This uses the ISO-3166 format, with two-letter codes. CloudWatch metrics that you can collect with CloudWatch RUM 1904 Amazon CloudWatch User Guide Example dimension values: US, JP, DE • DeviceType Example dimension values: desktop, mobile, tablet, embedded • FileType Example dimension values: Image, Stylesheet • OSName Example dimension values: Linux, Windows, iOS, Android • PageId Set up extended metrics using the console To use the console to send extended metrics to CloudWatch, use the following steps. To send extended metrics to CloudWatch Evidently, you must use the AWS APIs or AWS CLI instead of the console. For information about using the AWS APIs to send extended metrics to either CloudWatch or Evidently, see PutRumMetricsDestination and BatchCreateRumMetricDefinitions. To use the console to set up an app monitor and send RUM extended metrics to CloudWatch 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, RUM. 3. Choose List view and then choose the name of the app monitor that is to send the metrics. 4. Choose the Configuration tab and then choose RUM extended metrics. 5. Choose Send metrics. 6. 7. Select one or more metric names to send with additional dimensions. Select one or more factors to use as dimensions for these metrics. As you make your choices, the number of extended metrics that your choices create is displayed in Number of extended metrics. This number is calculated by multiplying the number of chosen metric names by the number of different dimensions that you create. a. To send a metric with page ID as a dimension, choose Browse for page ID and then select the page IDs to use. CloudWatch metrics that you can collect with CloudWatch RUM 1905 Amazon CloudWatch User Guide b.
acw-ug-510
acw-ug.pdf
510
metric names to send with additional dimensions. Select one or more factors to use as dimensions for these metrics. As you make your choices, the number of extended metrics that your choices create is displayed in Number of extended metrics. This number is calculated by multiplying the number of chosen metric names by the number of different dimensions that you create. a. To send a metric with page ID as a dimension, choose Browse for page ID and then select the page IDs to use. CloudWatch metrics that you can collect with CloudWatch RUM 1905 Amazon CloudWatch User Guide b. c. d. e. To send a metric with device type as a dimension, choose either Desktop devices or Mobile and tablets. To send a metric with operating system as a dimension, select one or more operating systems under Operating system. To send a metric with browser type as a dimension, select one or more browsers under Browsers. To send a metric with geolocation as a dimension, select one or more locations under Locations. Only the locations where this app monitor has reported metrics from will appear in the list to choose from. 8. When you are finished with your choices, choose Send metrics. 9. (Optional) In the Extended metrics list, to create an alarm that watches one of the metrics, choose Create alarm in that metric's row. For general information about CloudWatch alarms, see Using Amazon CloudWatch alarms. For a tutorial for setting an alarm on a CloudWatch RUM extended metric, see Tutorial: create an extended metric and alarm it. Stop sending extended metrics To use the console to stop sending extended metrics 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, RUM. 3. Choose List view and then choose the name of the app monitor that is to send the metrics. 4. Choose the Configuration tab and then choose RUM extended metrics. 5. Select one or more metric name and dimension combinations to stop sending. Then choose Actions, Delete. Tutorial: create an extended metric and alarm it This tutorial demonstrates how to set up an extended metric to be sent to CloudWatch, and then how to set an alarm on that metric. In this tutorial, you create a metric that tracks JavaScript errors on the Chrome browser. CloudWatch metrics that you can collect with CloudWatch RUM 1906 Amazon CloudWatch User Guide To set up this extended metric and set an alarm on it 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, RUM. 3. Choose List view and then choose the name of the app monitor that is to send the metric. 4. Choose the Configuration tab and then choose RUM extended metrics. 5. Choose Send metrics. 6. Select JSErrorCount. 7. Under Browsers, select Chrome. This combination of JSErrorCount and Chrome will send one extended metric to CloudWatch. The metric counts JavaScript errors only for user sessions that use the Chrome browser. The metric name will be JsErrorCount and the dimension name will be Browser. 8. Choose Send metrics. 9. In the Extended metrics list, choose Create alarm in the row that displays JsErrorCount under Name and displays Chrome under BrowserName. 10. Under Specify metric and conditions, confirm that the Metric name and BrowserName fields are pre-filled with the correct values. 11. For Statistic, select the statistic that you want to use for the alarm. Average is a good choice for this type of counting metric. 12. For Period, select 5 minutes. 13. Under Conditions, do the following: • Choose Static. • Choose Greater to specify that the alarm should go into ALARM state when the number of errors is higher than the threshold you are about to specify. • Under than..., enter the number for the alarm threshold. The alarm goes into ALARM state when the number of errors over a 5-minute period exceeds this number. 14. (Optional) By default, the alarm goes into ALARM state as soon as the number of errors exceeds the threshold number you set during a 5-minute period. You can optionally change this so that the alarm goes into ALARM state only if this number is exceeded for more than one 5-minute period. To do so, choose Additional configuration and then for Datapoints to alarm, specify how many 5-minute periods need to have the error number over the threshold to trigger the alarm. CloudWatch metrics that you can collect with CloudWatch RUM 1907 Amazon CloudWatch User Guide For example, you can select 2 out of 2 to have the alarm trigger only when two consecutive 5-minute periods are over the threshold, or 2 out of 3 to have the alarm trigger if any two of three consecutive 5-minute periods are over the threshold. For more information about this type of alarm
acw-ug-511
acw-ug.pdf
511
5-minute period. To do so, choose Additional configuration and then for Datapoints to alarm, specify how many 5-minute periods need to have the error number over the threshold to trigger the alarm. CloudWatch metrics that you can collect with CloudWatch RUM 1907 Amazon CloudWatch User Guide For example, you can select 2 out of 2 to have the alarm trigger only when two consecutive 5-minute periods are over the threshold, or 2 out of 3 to have the alarm trigger if any two of three consecutive 5-minute periods are over the threshold. For more information about this type of alarm evaluation, see Evaluating an alarm. 15. Choose Next. 16. For Configure actions, specify what should happen when the alarm goes into alarm state. To receive a notification with Amazon SNS, do the following: • Choose Add notification. • Choose In alarm. • Either select an existing SNS topic or create a new one. If you create a new one, specify a name for it and add at least one email address to it. 17. Choose Next. 18. Enter a name and optional description for the alarm, and choose Next. 19. Review the details and choose Create alarm. Data protection and data privacy with CloudWatch RUM The AWS shared responsibility model applies to data protection and data privacy in Amazon CloudWatch RUM. As described in this model, AWS is responsible for protecting the global infrastructure that runs all of the AWS cloud. You are responsible for maintaining control over your content that is hosted on this infrastructure. For more information about data privacy, see the Data Privacy FAQ. For information about data protection in Europe, see The AWS Shared Responsibility Model and GDPR blog post on the AWS Security Blog. For more resources about complying with GDPR requirements, see the General Data Protection Regulation (GDPR) Center. Amazon CloudWatch RUM generates a code snippet for you to embed into your website or web application code, based on your input of end user data that you want to collect. The web client, downloaded and configured by the code snippet, uses cookies (or similar technologies) to help you collect end user data. The use of cookies (or similar technologies) is subject to data privacy regulations in certain jurisdictions. Before using Amazon CloudWatch RUM, we strongly recommend that you assess your compliance obligations under applicable law, including any applicable legal requirements to provide legally adequate privacy notices and obtain any necessary consents for the use of cookies and the processing (including collection) of end user data. For more information about how the web client uses cookies (or similar technologies) and what end-user Data protection and data privacy with CloudWatch RUM 1908 Amazon CloudWatch User Guide data the web client collects, see Information collected by the CloudWatch RUM web client and CloudWatch RUM web client cookies (or similar technologies). We strongly recommend that you never put sensitive identifying information, such as your end users’ account numbers, email addresses, or other personal information, into free-form fields. Any data that you enter into Amazon CloudWatch RUM or other services might be included in diagnostic logs. CloudWatch RUM web client cookies (or similar technologies) The CloudWatch RUM web client collects certain data about user sessions by default. You can choose to enable cookies to have the web client collect a user ID and session ID that persist across page loads. The user ID is randomly generated by RUM. If these cookies are enabled, RUM is able to display the following types of data when you view the RUM dashboard for this app monitor. • Aggregated data based on user IDs, such as number of unique users and the number of different users who experienced an error. • Aggregated data based on session IDs, such as number of sessions and the number of sessions that experienced an error. • The user journey, which is the sequence of pages that each sampled user session includes. Important If you do not enable these cookies (or similar technologies), the web client still records certain information about end user sessions such as browser type/version, operating system type/version, device type, and so on. These are collected to provide aggregated page-specific insights, such as web vitals, page views, and pages that experienced errors. For more information about the data recorded, see Information collected by the CloudWatch RUM web client. Information collected by the CloudWatch RUM web client This section documents the PutRumEvents schema, which defines the structure of the data that you can collect from user sessions using CloudWatch RUM. Information collected by the CloudWatch RUM web client 1909 Amazon CloudWatch User Guide A PutRumEvents request sends a data structure with the following fields to CloudWatch RUM. • The ID of this batch of RUM events • App monitor details, which includes the following: • App
acw-ug-512
acw-ug.pdf
512
page views, and pages that experienced errors. For more information about the data recorded, see Information collected by the CloudWatch RUM web client. Information collected by the CloudWatch RUM web client This section documents the PutRumEvents schema, which defines the structure of the data that you can collect from user sessions using CloudWatch RUM. Information collected by the CloudWatch RUM web client 1909 Amazon CloudWatch User Guide A PutRumEvents request sends a data structure with the following fields to CloudWatch RUM. • The ID of this batch of RUM events • App monitor details, which includes the following: • App monitor ID • Monitored application version • User details, which includes the following. This is collected only if the app monitor has cookies enabled. • A user ID generated by the web client • Session ID • The array of RUM events in this batch. RUM event schema The structure of each RUM event includes the following fields. • The ID of the event • A timestamp • The event type • The user agent • Metadata • RUM event details RUM event metadata The metadata includes page metadata, user agent metadata, geolocation metadata, and domain metadata. Page metadata The page metadata includes the following: • Page ID • Page title Information collected by the CloudWatch RUM web client 1910 Amazon CloudWatch User Guide • Parent page ID. – This is collected only if the app monitor has cookies enabled. • Interaction depth – This is collected only if the app monitor has cookies enabled. • Page tags – You can add tags to page events to group pages together. For more information, see Use page groups. User agent metadata The user agent metadata includes the following: • Browser language • Browser name • Browser version • Operating system name • Operating system version • Device type • Platform type Geolocation metadata The geolocation metadata includes the following: • Country code • Subdivision code Domain metadata The domain metadata includes the URL domain. RUM event details The details of an event follow one of the following type of schemas, depending on the event type. Session start event This event contains no fields. This is collected only if the app monitor has cookies enabled. Information collected by the CloudWatch RUM web client 1911 Amazon CloudWatch Page view schema User Guide A Page view event contains the following properties. You can deactivate page view collection by configuring the web client. For more information, see the CloudWatch RUM web client documentation. Name Page ID Type String Parent page ID String Description An ID that uniquely represents this page within the application. By default, this is the URL path. The ID of the page that the user was on when they navigated to the current page. This is collected only if the app monitor has cookies enabled. Interaction depth String This is collected only if the app monitor has cookies enabled. JavaScript error schema JavaScript error events generated by the agent contain the following properties. The web client collects these events only if you selected to collect the errors telemetry. Name Type Description Error type String The error's name, if one exists. For more information, see Error.prototype.name. Error message String Some browsers might not support error types. The error's message. For more information, see Error.pro totype.message. If the error field does not exist, this is the message of the error event. For more information, see ErrorEvent. Error messages might not be consistent across different browsers. Information collected by the CloudWatch RUM web client 1912 Amazon CloudWatch User Guide Name Type Description Stack trace String The error's stack trace, if one exists, truncated to 150 characters. For more information, see Error.prototype.st ack. Some browsers might not support stack traces. DOM event schema Document object model (DOM) events generated by the agent contain the following properties. These events are not collected by default. They are collected only if you activate the interactions telemetry. For more information, see the CloudWatch RUM web client documentation. Name Event Type String Description The type of DOM event, such as click, scroll, or hover. For more information, see Event reference. Element String The DOM element type Element ID String If the element that generated the event has an ID, this property stores that ID. For more information, see Element.id. CSSLocator String The CSS locator used to identify the DOM element. InteractionId String A unique ID for the interaction between the user and the UI. Navigation event schema Navigation events are collected only if the app monitor has performance telemetry activated. Navigation events use Navigation timing Level 1 and Navigation timing Level 2 APIs. Level 2 APIs are not supported on all browsers, so these newer fields are optional. Information collected by the CloudWatch RUM web client 1913 Amazon CloudWatch Note User
acw-ug-513
acw-ug.pdf
513
element that generated the event has an ID, this property stores that ID. For more information, see Element.id. CSSLocator String The CSS locator used to identify the DOM element. InteractionId String A unique ID for the interaction between the user and the UI. Navigation event schema Navigation events are collected only if the app monitor has performance telemetry activated. Navigation events use Navigation timing Level 1 and Navigation timing Level 2 APIs. Level 2 APIs are not supported on all browsers, so these newer fields are optional. Information collected by the CloudWatch RUM web client 1913 Amazon CloudWatch Note User Guide Timestamp metrics are based on DOMHighResTimestamp. With Level 2 APIs, all timings are by default relative to the startTime. But for Level 1, the navigationStart metric is subtracted from timestamp metrics to obtain relative values. All timestamp values are in milliseconds. Navigation events contain the following properties. Name Type Description Notes initiatorType String Represents the type of resource that initiated the performance event. Value: "navigation" navigatio nType String Represents the type of navigation. This attribute is not required. Level 1: "navigation" Level 2: entryData .initiatorType Value: The value must be one of the following: • navigate is a navigation started by choosing a link, entering a URL in a browser's address bar, form Information collected by the CloudWatch RUM web client 1914 Amazon CloudWatch User Guide Name Type Description Notes submissio n, or initializing through a script operation other than reload or back_forw ard . • reload is a navigatio n through the browser's reload operation or location. reload() . • back_forw ard is a navigatio n through the browser's history traversal operation. • prerender is a navigatio n initiated Information collected by the CloudWatch RUM web client 1915 Amazon CloudWatch User Guide Name Type Description Notes by a prerender hint. For more informati on, see Prerender. startTime Number Indicates when the event is triggered. Value: 0 Level 1: entryData .navigati onStart - entryData .navigati onStart Level 2: entryData .startTime Information collected by the CloudWatch RUM web client 1916 Amazon CloudWatch User Guide Name Type Description unloadEve ntStart Number Indicates the time when the previous document in the window began to unload after the unload event was thrown. Notes Value: If there is no previous document or if the previous document or one of the needed redirects is not of the same origin, the value returned is 0. Level 1: entryData .unloadEv entStart > 0 ? entryData .unloadEv entStart - entryData .navigati onStart : 0 Level 2: entryData .unloadEv entStart Information collected by the CloudWatch RUM web client 1917 Amazon CloudWatch User Guide Name Type Description promptFor Unload Number The time taken to unload the document. In other words, the time between unloadEve ntStart and unloadEventEnd . UnloadEventEnd represents the moment in milliseconds when the unload event handler finishes. Notes Value: If there is no previous document or if the previous document or one of the needed redirects is not of the same origin, the value returned is 0. Level 1: entryData .unloadEv entEnd - entryData .unloadEv entStart Level 2: entryData .unloadEv entEnd - entryData .unloadEv entStart Information collected by the CloudWatch RUM web client 1918 Amazon CloudWatch User Guide Name Type Description redirectC ount Number A number representing the number of redirects since the last non-redirect navigation under the current browsing context. This attribute is not required. Notes Value: If there is no redirect or if there is any redirect that is not of the same origin as the destination document, the value returned is 0. Level 1: Not available Level 2: entryData .redirect Count Information collected by the CloudWatch RUM web client 1919 Amazon CloudWatch User Guide Name Type Description redirectStart Number The time when the first HTTP redirect starts. Notes Value: If there is no redirect or if there is any redirect that is not of the same origin as the destination document, the value returned is 0. Level 1: entryData .redirect Start > 0 ? entryData .redirect Start - entryData .navigati onStart : 0 Level 2: entryData .redirectStart Information collected by the CloudWatch RUM web client 1920 Amazon CloudWatch User Guide Name Type Description redirectTime Number The time taken for the HTTP redirect. This is the difference between redirectStart and redirectEnd . Notes Level 1: : entryData .redirectEnd - entryData .redirectStart Level 2: : entryData .redirectEnd - entryData .redirectStart Information collected by the CloudWatch RUM web client 1921 Amazon CloudWatch User Guide Name Type Description workerStart Number This is a property of the Performan ceResourceTiming beginning of worker thread operation. interface. It marks the This attribute is not required. Notes Value: If a Service Worker thread is already running, or immediate ly before starting the Service Worker thread, this property returns the time immediate ly before dispatching FetchEven t . It returns 0 if the
acw-ug-514
acw-ug.pdf
514
the difference between redirectStart and redirectEnd . Notes Level 1: : entryData .redirectEnd - entryData .redirectStart Level 2: : entryData .redirectEnd - entryData .redirectStart Information collected by the CloudWatch RUM web client 1921 Amazon CloudWatch User Guide Name Type Description workerStart Number This is a property of the Performan ceResourceTiming beginning of worker thread operation. interface. It marks the This attribute is not required. Notes Value: If a Service Worker thread is already running, or immediate ly before starting the Service Worker thread, this property returns the time immediate ly before dispatching FetchEven t . It returns 0 if the resource is not intercept ed by a Service Worker. Level 1: Not available Level 2: entryData .workerStart Information collected by the CloudWatch RUM web client 1922 Amazon CloudWatch User Guide Name Type Description Notes workerTime Number If the resource is intercepted by a Service Worker, this returns the time required for Level 1: Not available worker thread operation. This attribute is not required. Level 2: entryData .workerSt art > 0 ? entryData .fetchSta rt - entryData .workerSt art : 0 fetchStart Number The time when the browser is ready to fetch the document using an HTTP request. This is Level 1: before checking any application cache. : entryData .fetchSta rt > 0 ? entryData .fetchSta rt - entryData .navigati onStart : 0 Level 2: entryData .fetchStart Information collected by the CloudWatch RUM web client 1923 Amazon CloudWatch Name Type Description domainLoo kupStart Number The time when the domain lookup starts. User Guide Notes Value: If a persistent connection is used or if the information is stored in a cache or local resource, the value will be the same as fetchStar t . Level 1: entryData .domainLo okupStart > 0 ? entryData .domainLo okupStart - entryData .navigati onStart : 0 Level 2: entryData .domainLo okupStart Information collected by the CloudWatch RUM web client 1924 Amazon CloudWatch User Guide Name Type Description dns Number The time required for domain lookup. Notes Value: If the resources and DNS records are cached, the expected value is 0. Level 1: entryData .domainLo okupEnd - entryData .domainLo okupStart Level 2: entryData .domainLo okupEnd - entryData .domainLo okupStart nextHopPr otocol String A string representing the network protocol used to fetch the resource. Level 1: Not available This attribute is not required. Level 2: entryData .nextHopP rotocol Information collected by the CloudWatch RUM web client 1925 Amazon CloudWatch User Guide Name Type Description connectStart Number The time immediately before the user agent starts establishing the connection to the server to retrieve the document. Notes Value: If an RFC2616 persistent connection is used, or if the current document is retrieved from relevant applicati on caches or local resources, this attribute returns the value of domainLoo kupEnd . Level 1: entryData .connectS tart > 0 ? entryData .connectS tart - entryData .navigati onStart : 0 Level 2: entryData .connectStart Information collected by the CloudWatch RUM web client 1926 Amazon CloudWatch User Guide Name Type Description Notes connect Number Measures the time required to establish the transport connections or to perform SSL Level 1: entryData authentication. It also includes the blocked .connectEnd time that is taken when there are too many - entryData concurrent requests issued by the browser. .connectStart secureCon nectionStart Number If the URL scheme of the current page is "https", this attribute returns the time immediately before the user agent starts Level 2: entryData .connectEnd - entryData .connectStart Formula: entryData .secureCo the handshake process to secure the current nnectionS connection. It returns 0 if HTTPS is not used. tart For more information about URL schemes, see URL representation. Information collected by the CloudWatch RUM web client 1927 Amazon CloudWatch User Guide Name Type Description Notes tlsTime Number The time taken to complete an SSL handshake. Level 1: entryData .secureCo nnectionS tart > 0 ? entryData .connectE nd - entryData .secureCo nnectionS tart : 0 Level 2: entryData .secureCo nnectionS tart > 0 ? entryData .connectE nd - entryData .secureCo nnectionS tart : 0 Information collected by the CloudWatch RUM web client 1928 Amazon CloudWatch User Guide Name Type Description requestStart Number The time immediately before the user agent starts requesting the resource from the server, Notes Level 1: or from relevant application caches, or from : local resources. timeToFir stByte Number The time taken to receive the first byte of information after a request is made. This time is relative to the startTime . entryData .requestS tart > 0 ? entryData .requestS tart - entryData .navigati onStart : 0 Level 2: entryData .requestStart Level 1: entryData .response Start - entryData .requestStart Level 2: entryData .response Start - entryData .requestStart Information collected by the CloudWatch RUM web client 1929 Amazon CloudWatch User Guide Name Type Description responseS tart Number The time immediately after the user agent's HTTP parser receives
acw-ug-515
acw-ug.pdf
515
or from relevant application caches, or from : local resources. timeToFir stByte Number The time taken to receive the first byte of information after a request is made. This time is relative to the startTime . entryData .requestS tart > 0 ? entryData .requestS tart - entryData .navigati onStart : 0 Level 2: entryData .requestStart Level 1: entryData .response Start - entryData .requestStart Level 2: entryData .response Start - entryData .requestStart Information collected by the CloudWatch RUM web client 1929 Amazon CloudWatch User Guide Name Type Description responseS tart Number The time immediately after the user agent's HTTP parser receives the first byte of the response from the relevant application caches, or from local resources, or from the server. Notes Level 1: entryData .response Start > 0 ? entryData .response Start - entryData .navigati onStart : 0 Level 2: entryData .response Start Information collected by the CloudWatch RUM web client 1930 Amazon CloudWatch User Guide Name responseT ime Type String Description The time taken to receive a complete response in the form of bytes from the relevant application caches, or from local resources, or from the server. Notes Level 1: entryData .response Start > 0 ? entryData .response End - entryData .response Start : 0 Level 2: entryData .response Start > 0 ? entryData .response End - entryData .response Start : 0 Information collected by the CloudWatch RUM web client 1931 Amazon CloudWatch User Guide Name Type Description domIntera ctive Number The time when the parser finished its work on the main document, and the HTML DOM is constructed. At this time, its Document. changes to "interactive" and readyState the corresponding readystatechange event is thrown. Notes Level 1: entryData .domInter active > 0 ? entryData .domInter active - entryData .navigati onStart : 0 Level 2: entryData .domInter active Information collected by the CloudWatch RUM web client 1932 Amazon CloudWatch User Guide Name Type Description Number domConten tLoadedEv entStart Represents the time value equal to the time immediately before the user agent fires the DOMContentLoaded event at the current document. TheDOMContentLoaded event fires when the initial HTML document has been completely loaded and parsed. At this time, the main HTML document has finished Notes Level 1: entryData .domConte ntLoadedE ventStart > 0 ? parsing, the browser begins constructing the entryData render tree, and subresources still have to be loaded. This does not wait for style sheets, images, and subframes to finish loading. .domConte ntLoadedE ventStart - entryData .navigati onStart : 0 Level 2: entryData .domConte ntLoadedE ventStart Information collected by the CloudWatch RUM web client 1933 Amazon CloudWatch User Guide Notes Level 2: entryData .domConte ntLoadedE ventEnd - entryData .domConte ntLoadedE ventStart Level 2: entryData .domConte ntLoadedE ventEnd - entryData .domConte ntLoadedE ventStart Name Type Description domConten tLoaded Number This start and end time of render tree tLoadedEventStart construction is marked by the domConten and domConten . It lets CloudWatch tLoadedEventEnd RUM track execution. This property is the difference between domContentLoadedSt art and domContentLoadedEnd . During this time, DOM and CSSOM are ready. This property waits on script execution, except for asynchronous and dynamically created scripts. If the scripts depend on style sheets, domContentLoaded waits on the style sheets, too. It does not wait on images. Note The actual values of domConten tLoadedStart and domConten approximate to tLoadedEnd domContentLoaded in Google Chrome's Network panel. It indicates HTML DOM + CSSOM render tree construction time from the beginning of the page loading process. In the case of navigation metrics, the domContentLoaded value represent s the difference between start and end values, which is the time required for downloading subresources and render- tree construction only. Information collected by the CloudWatch RUM web client 1934 Amazon CloudWatch User Guide Name Type Description domComple te Number The time immediately before the browser sets the current document readiness of the current document to complete. At this point, the loading of subresources, such as images, is complete. This includes the time taken for downloading blocking content such as CSS and synchronous JavaScript. This approxima tes to loadTime in Google Chrome’s Network panel. domProces singTime Number The total time between the response and the load event start. Notes Level 1: entryData .domCompl ete > 0 ? entryData .domCompl ete - entryData .navigati onStart : 0 Level 2: entryData .domCompl ete Level 1: entryData .loadEven tStart - entryData .responseEnd Level 2: entryData .loadEven tStart - entryData .responseEnd Information collected by the CloudWatch RUM web client 1935 Amazon CloudWatch User Guide Name Type Description loadEvent Start Number The time immediately before the load event of the current document is fired. loadEvent Time Number The difference between loadEventStart and loadEventEnd . Additional functions or logic waiting for this load event will be fired during this time. Notes Level 1: entryData .loadEven tStart > 0 ? entryData .loadEven tStart - entryData .navigati
acw-ug-516
acw-ug.pdf
516
ete - entryData .navigati onStart : 0 Level 2: entryData .domCompl ete Level 1: entryData .loadEven tStart - entryData .responseEnd Level 2: entryData .loadEven tStart - entryData .responseEnd Information collected by the CloudWatch RUM web client 1935 Amazon CloudWatch User Guide Name Type Description loadEvent Start Number The time immediately before the load event of the current document is fired. loadEvent Time Number The difference between loadEventStart and loadEventEnd . Additional functions or logic waiting for this load event will be fired during this time. Notes Level 1: entryData .loadEven tStart > 0 ? entryData .loadEven tStart - entryData .navigati onStart : 0 Level 2: entryData .loadEven tStart Level 1: entryData .loadEven tEnd - entryData .loadEven tStart Level 2: entryData .loadEven tEnd - entryData .loadEven tStart Information collected by the CloudWatch RUM web client 1936 Amazon CloudWatch User Guide Name Type Description Notes duration String Duration is the total page load time. It records the timing for downloading the main page Level 1: entryData and all of its synchronous subresources, and .loadEven also for rendering the page. Asynchronous tEnd - resources such as scripts continue to download entryData later. This is the difference between the .navigati loadEventEnd and startTime properties. onStart Level 2: entryData .duration headerSize Number Returns the difference between transferS ize and encodedBodySize . Level 1: Not available This attribute is not required. Level 2: entryData .transferSize - entryData .encodedB odySize Level 2: entryData .transferSize - entryData .encodedB odySize Information collected by the CloudWatch RUM web client 1937 Amazon CloudWatch Name Type Description compressi onRatio Number The ratio of encodedBodySize and decodedBodySize . The value of encodedBodySize is the compressed size of the resource excluding the HTTP headers. The value of decodedBodySize is the decompressed size of the resource excluding the HTTP headers. This attribute is not required. User Guide Notes Level 1: Not available. Level 2: entryData .encodedB odySize > 0 ? entryData .decodedB odySize / entryData .encodedB odySize : 0 Number The navigation timing API version. Value: 1 or 2 navigatio nTimingLe vel Resource event schema Resource events are collected only if the app monitor has performance telemetry activated. Timestamp metrics are based on The DOMHighResTimeStamp typedef. With Level 2 APIs, by default all timings are relative to the startTime. But for Level 1 APIs, the navigationStart metric is subtracted from timestamp metrics to obtain relative values. All timestamp values are in milliseconds. Resource events generated by the agent contain the following properties. Information collected by the CloudWatch RUM web client 1938 Amazon CloudWatch User Guide Name Type Description targetUrl String Returns the resource's URL. Notes Formula: entryData .name initiatorType String Represents the type of resource that initiated the performance resource event. Value: "resource" duration String Returns the difference between the responseEnd and startTime properties. This attribute is not required. Formula: entryData .initiatorType Formula: entryData .duration transferSize Number Returns the size (in octets) of the fetched resource, including the response header fields Formula: entryData and the response payload body. .transferSize This attribute is not required. fileType String Extensions derived from the target URL pattern. Largest contentful paint event schema Largest contentful paint events contain the following properties. These events are collected only if the app monitor has performance telemetry activated. Name Value Description For more information, see Web Vitals. Information collected by the CloudWatch RUM web client 1939 Amazon CloudWatch First input delay event User Guide First input delay events contain the following properties. These events are collected only if the app monitor has performance telemetry activated. Name Value Description For more information, see Web Vitals. Cumulative layout shift event Cumulative layout shift events contain the following properties. These events are collected only if the app monitor has performance telemetry activated. Description For more information, see Web Vitals. Name Value HTTP event HTTP events can contain the following properties. It will contain either a Response field or an Error field, but not both. These events are collected only if the app monitor has HTTP telemetry activated. Name Request Description The request field includes the following: • The Method field, which can have values such as GET, POST, and so on. Information collected by the CloudWatch RUM web client 1940 Amazon CloudWatch Name User Guide Description • The URL Response The response field includes the following: Error The error field includes the following: • Status, such as 2xx, 4xx, or 5xx • Status text • Type • Message • File name • Line number • Column number • Stack trace X-Ray trace event schema These events are collected only if the app monitor has X-Ray tracing activated. For information about X-Ray trace event schemas, see AWS X-Ray segment documents. Route change timing for single-page applications In a traditional multi-page application, when a user requests for new content to be loaded, the user is actually requesting a new
acw-ug-517
acw-ug.pdf
517
The URL Response The response field includes the following: Error The error field includes the following: • Status, such as 2xx, 4xx, or 5xx • Status text • Type • Message • File name • Line number • Column number • Stack trace X-Ray trace event schema These events are collected only if the app monitor has X-Ray tracing activated. For information about X-Ray trace event schemas, see AWS X-Ray segment documents. Route change timing for single-page applications In a traditional multi-page application, when a user requests for new content to be loaded, the user is actually requesting a new HTML page from the server. As a result, the CloudWatch RUM web client captures the load times using the regular performance API metrics. However, single-page web applications use JavaScript and Ajax to update the interface without loading a new page from the server. Single-page updates are not recorded by the browser timing API, but instead use route change timing. CloudWatch RUM supports the monitoring of both full page loads from the server and single-page updates, with the following differences: • For route change timing, there are no browser-provided metrics such as tlsTime, timeToFirstByte, and so on. Information collected by the CloudWatch RUM web client 1941 Amazon CloudWatch User Guide • For route change timing, the initiatorType field will be route_change. The CloudWatch RUM web client listens to user interactions that may lead to a route change, and when such a user interaction is recorded, the web client records a timestamp. Then route change timing will begin if both of the following are true: • A browser history API (except browser forward and back buttons) was used to perform the route change. • The difference between the time of route change detection and latest user interaction timestamp is less than 1000 ms. This avoids data skew. Then, once route change timing begins, that timing completes if there are no ongoing AJAX requests and DOM mutations. Then the timestamp of the latest completed activity will be used as the completion timestamp. Route change timing will time out if there are ongoing AJAX requests or DOM mutations for more than 10 seconds (by default). In this case, the CloudWatch RUM web client will no longer record timing for this route change. As a result, the duration of a route change event is calculated as the following: (time of latest completed activity) - (latest user interaction timestamp) Manage your applications that use CloudWatch RUM Use the steps in these sections to manage your applications' use of CloudWatch RUM. Topics • How do I find a code snippet that I've already generated? • Editing your CloudWatch RUM app monitor settings • Stopping using CloudWatch RUM or deleting an app monitor How do I find a code snippet that I've already generated? To find a CloudWatch RUM code snippet that you've already generated for an application, follow these steps. Manage your applications that use CloudWatch RUM 1942 Amazon CloudWatch User Guide To find a code snippet that you've already generated 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, RUM. 3. Choose List view. 4. Next to the name of the app monitor, choose View JavaScript. 5. In the JavaScript Snippet pane, choose Copy to clipboard. Editing your CloudWatch RUM app monitor settings To change an app monitor's settings, follow these steps. You can change any settings except the app monitor name. To edit how your application uses CloudWatch RUM 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, RUM. 3. Choose List view. 4. Choose the button next to the name of the application, and then choose Actions, Edit. 5. Change any settings except the application name. For more information about the settings, see Creating a CloudWatch RUM app monitor. 6. When finished, choose Save. Changing the settings changes the code snippet. You must now paste the updated code snippet into your application. 7. After the JavaScript code snippet is created, choose Copy to clipboard or Download, and then choose Done. To start monitoring with the new settings, you insert the code snippet into your application. Insert the code snippet inside the <head> element of your application, before the <body> element or any other <script> tags. Stopping using CloudWatch RUM or deleting an app monitor To stop using CloudWatch RUM with an application, remove the code snippet that RUM generated from your application's code. Manage your applications that use CloudWatch RUM 1943 Amazon CloudWatch User Guide To delete a RUM app monitor, follow these steps. To delete an app monitor 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, RUM. 3. Choose List view. 4. Choose the button next to the name of the application, and then
acw-ug-518
acw-ug.pdf
518
element of your application, before the <body> element or any other <script> tags. Stopping using CloudWatch RUM or deleting an app monitor To stop using CloudWatch RUM with an application, remove the code snippet that RUM generated from your application's code. Manage your applications that use CloudWatch RUM 1943 Amazon CloudWatch User Guide To delete a RUM app monitor, follow these steps. To delete an app monitor 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, RUM. 3. Choose List view. 4. Choose the button next to the name of the application, and then choose Actions, Delete. 5. 6. In the confirmation box, enter Delete and then choose Delete. If you haven't done so already, delete the CloudWatch RUM code snippet from your application's code. CloudWatch RUM quotas CloudWatch RUM has the following quotas. Resource App monitors Default quota 20 per account You can request a quota increase. RUM ingestion rate 50 PutRumEvents requests per second (TPS). You can request a quota increase. Troubleshooting CloudWatch RUM This section contains tips to help you troubleshoot CloudWatch RUM. There is no data for my application First, make sure that the code snippet has been correctly inserted into your application. For more information, see Inserting the CloudWatch app monitor code snippet into your application. If that is not the issue, then maybe there has been no traffic to your application yet. Generate some traffic by accessing your application the same way that a user would. CloudWatch RUM quotas 1944 Amazon CloudWatch User Guide Data has stopped being recorded for my application Your application might have been updated and now no longer contains a CloudWatch RUM code snippet. Check your application code. Another possibility is that someone may have updated the code snippet but then didn't insert the updated snippet into the application. Find the current correct code snippet by following the directions in How do I find a code snippet that I've already generated? and compare it to the code snippet that is pasted into your application. Perform launches and A/B experiments with CloudWatch Evidently Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. You can use Amazon CloudWatch Evidently to safely validate new features by serving them to a specified percentage of your users while you roll out the feature. You can monitor the performance of the new feature to help you decide when to ramp up traffic to your users. This helps you reduce risk and identify unintended consequences before you fully launch the feature. You can also conduct A/B experiments to make feature design decisions based on evidence and data. An experiment can test as many as five variations at once. Evidently collects experiment data and analyzes it using statistical methods. It also provides clear recommendations about which variations perform better. You can test both user-facing features and backend features. Evidently pricing Evidently charges your account based on Evidently events and Evidently analysis units. Evidently events include both data events such as clicks and page views, and assignment events that determine the feature variation to serve to a user. Evidently analysis units are generated from Evidently events, based on rules that you have created in Evidently. Analysis units are the number of rule matches on events. For example, a user click Perform launches and A/B experiments with CloudWatch Evidently 1945 Amazon CloudWatch User Guide event might produce a single Evidently analysis unit, a click count. Another example is a user checkout event that might produce two Evidently analysis units, checkout value and the number of items in cart. For more information about pricing, see Amazon CloudWatch Pricing. CloudWatch Evidently is currently available in the following Regions: • US East (Ohio) • US East (N. Virginia) • US West (Oregon) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Stockholm) Topics • IAM policies to use Evidently • Create projects, features, launches, and experiments • Manage features, launches, and experiments • Adding code to your application • Evidently project data storage in CloudWatch • How Evidently calculates results • View launch results in the dashboard • View experiment results in the dashboard • How CloudWatch Evidently collects and stores data • Using service-linked roles for Evidently • Evidently quotas in CloudWatch • Tutorial: A/B testing with the Evidently sample application Perform launches and A/B experiments with CloudWatch Evidently 1946 Amazon CloudWatch User Guide IAM policies to use Evidently Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console
acw-ug-519
acw-ug.pdf
519
data storage in CloudWatch • How Evidently calculates results • View launch results in the dashboard • View experiment results in the dashboard • How CloudWatch Evidently collects and stores data • Using service-linked roles for Evidently • Evidently quotas in CloudWatch • Tutorial: A/B testing with the Evidently sample application Perform launches and A/B experiments with CloudWatch Evidently 1946 Amazon CloudWatch User Guide IAM policies to use Evidently Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. To fully manage CloudWatch Evidently, you must be signed in as an IAM user or role that has the following permissions: • The AmazonCloudWatchEvidentlyFullAccess policy • The ResourceGroupsandTagEditorReadOnlyAccess policy Additionally, to be able to create a project that stores evaluation events in Amazon S3 or CloudWatch Logs, you need the following permissions: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetBucketPolicy", "s3:PutBucketPolicy", "s3:GetObject", "s3:ListBucket" ], "Resource": "arn:aws:s3:::*" }, { "Effect": "Allow", "Action": [ "logs:CreateLogDelivery", "logs:DeleteLogDelivery", "logs:DescribeResourcePolicies", "logs:PutResourcePolicy" ], "Resource": [ IAM policies to use Evidently 1947 Amazon CloudWatch "*" ] } ] } User Guide Additional permissions for CloudWatch RUM integration Additionally, if you intend to manage Evidently launches or experiments that integrate with Amazon CloudWatch RUM and use CloudWatch RUM metrics for monitoring, you need the AmazonCloudWatchRUMFullAccess policy. To create an IAM role to give the CloudWatch RUM web client permission to send data to CloudWatch RUM, you need the following permissions: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iam:CreateRole", "iam:CreatePolicy", "iam:AttachRolePolicy" ], "Resource": [ "arn:aws:iam::*:role/service-role/CloudWatchRUMEvidentlyRole-*", "arn:aws:iam::*:policy/service-role/CloudWatchRUMEvidentlyPolicy-*" ] } ] } Permissions for read-only access to Evidently For other users who need to view Evidently data but don't need to create Evidently resources, you can grant the AmazonCloudWatchEvidentlyReadOnlyAccess policy. IAM policies to use Evidently 1948 Amazon CloudWatch User Guide Create projects, features, launches, and experiments Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. To get started with CloudWatch Evidently, for either a feature launch or an A/B experiment, you first create a project. A project is a logical grouping of resources. Within the project, you create features that have variations that you want to test or launch. You can create a feature either before you create a launch or experiment, or at the same time. Topics • Create a new project • Use client-side evaluation - powered by AWS AppConfig • Add a feature to a project • Use segments to focus your audience • Create a launch • Create an experiment Create a new project Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. Use these steps to set up a new CloudWatch Evidently project. To create a new CloudWatch Evidently project 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. Create projects, features, launches, and experiments 1949 Amazon CloudWatch User Guide 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose Create project. 4. For Project name, enter a name to be used to identify this project within the CloudWatch Evidently console. You can optionally add a project description. 5. For Evaluation event storage, choose whether you want to store the evaluation events that you collect with Evidently. Even if you don't store these events, Evidently aggregates them to create metrics and other experiment data that you can view in the Evidently dashboard. For more information, see Evidently project data storage in CloudWatch. 6. For Use client-side evaluation, choose whether you want to enable client-side evaluation for this project. With client-side evaluation, your application can assign variations to user sessions locally instead of by calling the EvaluateFeature operation. This mitigates the latency and availability risks that come with an API call. For more information, see Use client-side evaluation - powered by AWS AppConfig. To create a project with client-side evaluation, you must have the evidently:ExportProjectAsConfiguration permission. If you enable client-side evaluation, also do the following: a. Choose whether to use an existing AWS AppConfig application or create a new one. b. Choose whether to use an existing AWS AppConfig environment or create a new one. For more information about applications and environments in AWS AppConfig, see How AWS AppConfig works. 7. (Optional) To add tags to this project, choose Tags, Add new tag. Then, for Key, enter a name for the tag. You can add an optional value for the tag in Value. To add another tag, choose Add new tag again. For more information, see Tagging AWS Resources.
acw-ug-520
acw-ug.pdf
520
client-side evaluation, also do the following: a. Choose whether to use an existing AWS AppConfig application or create a new one. b. Choose whether to use an existing AWS AppConfig environment or create a new one. For more information about applications and environments in AWS AppConfig, see How AWS AppConfig works. 7. (Optional) To add tags to this project, choose Tags, Add new tag. Then, for Key, enter a name for the tag. You can add an optional value for the tag in Value. To add another tag, choose Add new tag again. For more information, see Tagging AWS Resources. 8. Choose Create project. Create projects, features, launches, and experiments 1950 Amazon CloudWatch User Guide Use client-side evaluation - powered by AWS AppConfig Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. You can use client-side evaluation - powered by AWS AppConfig (client-side evaluation) in a project, which lets your application assign variations to user sessions locally instead of assigning variations by calling the EvaluateFeature operation. This mitigates the latency and availability risks that come with an API call. To use client-side evaluation, attach the AWS AppConfig Lambda extension as a layer to your Lambda functions and configure the environment variables. The client-side evaluation runs as a side process on the local host. Then, you can call the EvaluationFeature and PutProjectEvent operations against localhost. The client-side evaluation process handles the variation assignment, caching, and data synchronization. For more information about AWS AppConfig, see How AWS AppConfig works. When you integrate with AWS AppConfig, you specify an AWS AppConfig application ID and an AWS AppConfig environment ID to Evidently. You can use the same application ID and environment ID across Evidently projects. When you create a project with client-side evaluation enabled, Evidently creates an AWS AppConfig configuration profile for that project. The configuration profile for each project will be different. Client-side evaluation access control Evidently client-side evaluation uses a different access control mechanism than the rest of Evidently does. We strongly recommend that you understand this so that you can implement the proper security measures. With Evidently, you can create IAM policies that limit the actions a user can perform on individual resources. For example, you can create a user role that disallows a user from having the EvaluateFeature action. For more information about the Evidently actions that can be controlled with IAM policies, see Actions defined by Amazon CloudWatch Evidently. Create projects, features, launches, and experiments 1951 Amazon CloudWatch User Guide The client-side evaluation model allows local evaluations of Evidently features that use project metadata. A user of a project with client-side evaluation enabled can call the EvaluateFeature API against a local host endpoint, and this API call does not reach Evidently and is not authenticated by the Evidently service's IAM policies. This call is successful even if the user doesn't have the IAM permission to use the EvaluateFeature action. However, a user still needs the PutProjectEvents permission for the agent to buffer the evaluation events or custom events and to offload data to Evidently asynchronously. Additionally, a user must have the evidently:ExportProjectAsConfiguration permission to be able to create a project that uses client-side evaluation. This helps you control access to EvaluateFeature actions that are called during client-side evaluation. If you aren't careful, the client-side evaluation security model can subvert the policies that you have set on the rest of Evidently. A user who has the evidently:ExportProjectAsConfiguration permission can create a project with client-side evaluation enabled, and then use the EvaluateFeature action for client-side evaluation with that project even if they are expressly denied the EvaluateFeature action in an IAM policy. Get started with Lambda Evidently currently supports client-side evaluation by using an AWS Lambda environment. To get started, first decide which AWS AppConfig application and environment to use. Choose an existing application and environment, or create new ones. The following sample AWS AppConfig AWS CLI commands create an application and environment. aws appconfig create-application --name YOUR_APP_NAME aws appconfig create-environment --application-id YOUR_APP_ID -- name YOUR_ENVIRONMENT_NAME Next, create an Evidently project by using these AWS AppConfig resources. For more information, see Create a new project. Client-side evaluation is supported in Lambda by using a Lambda layer. This is a public layer that is part of AWS-AppConfig-Extension, a public AWS AppConfig extension created by the AWS AppConfig service. For more information about Lambda layers, see Layer. To use client-side evaluation, you must add this layer to your Lambda function and configure permissions and environment variables. Create projects, features, launches, and experiments 1952 Amazon CloudWatch User Guide To add the Evidently client-side evaluation Lambda layer to your Lambda function and configure it 1. Create a Lambda function if
acw-ug-521
acw-ug.pdf
521
resources. For more information, see Create a new project. Client-side evaluation is supported in Lambda by using a Lambda layer. This is a public layer that is part of AWS-AppConfig-Extension, a public AWS AppConfig extension created by the AWS AppConfig service. For more information about Lambda layers, see Layer. To use client-side evaluation, you must add this layer to your Lambda function and configure permissions and environment variables. Create projects, features, launches, and experiments 1952 Amazon CloudWatch User Guide To add the Evidently client-side evaluation Lambda layer to your Lambda function and configure it 1. Create a Lambda function if you haven't already. 2. Add the client-side evaluation layer to your function. You can either specify its ARN or select it from the list of AWS layers if you haven't already. For more information, see Configuring functions to use layers and Available versions of the AWS AppConfig Lambda extension. 3. Create an IAM policy named EvidentlyAppConfigCachingAgentPolicy with the following contents, and attach it to the function's execution role. For more information, see Lambda execution role. { "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "appconfig:GetLatestConfiguration", "appconfig:StartConfigurationSession", "evidently:PutProjectEvents" ], "Resource": "*" } ] } 4. Add the required environment variable AWS_APPCONFIG_EXTENSION_EVIDENTLY_CONFIGURATIONS to your Lambda function. This environment variable specifies the mapping between the Evidently project and the AWS AppConfig resources. If you are using this function for one Evidently project, set the value of the environment variable to: applications/APP_ID/environments/ENVIRONMENT_ID/ configurations/PROJECT_NAME If you are using this function for multiple Evidently projects, use a comma to separate the values, as in the following example: applications/APP_ID_1/ environments/ENVIRONMENT_ID_1/configurations/PROJECT_NAME_1, Create projects, features, launches, and experiments 1953 Amazon CloudWatch User Guide applications/APP_ID_2/environments/ENVIRONMENT_ID_2/ configurations/PROJECT_NAME_2 5. 6. (Optional) Set other environment variables. For more information, see Configuring the AWS AppConfig Lambda extension. In your application, get Evidently evaluations locally by sending EvaluateFeature to localhost. Python example: import boto3 from botocore.config import Config def lambda_handler(event, context): local_client = boto3.client( 'evidently', endpoint_url="http://localhost:2772", config=Config(inject_host_prefix=False) ) response = local_client.evaluate_feature( project=event['project'], feature=event['feature'], entityId=event['entityId'] ) print(response) Node.js example: const AWS = require('aws-sdk'); const evidently = new AWS.Evidently({ region: "us-west-2", endpoint: "http://localhost:2772", hostPrefixEnabled: false }); exports.handler = async (event) => { const evaluation = await evidently.evaluateFeature({ project: 'John_ETCProject_Aug2022', feature: 'Feature_IceCreamFlavors', entityId: 'John' }).promise() Create projects, features, launches, and experiments 1954 Amazon CloudWatch User Guide console.log(evaluation) const response = { statusCode: 200, body: evaluation, }; return response; }; Kotlin example: String localhostEndpoint = "http://localhost:2772/" public AmazonCloudWatchEvidentlyClient getEvidentlyLocalClient() { return AmazonCloudWatchEvidentlyClientBuilder.standard() .withEndpointConfiguration(AwsClientBuilder.EndpointConfiguration(localhostEndpoint, region)) .withClientConfiguration(ClientConfiguration().withDisableHostPrefixInjection(true)) .withCredentials(credentialsProvider) .build(); } AmazonCloudWatchEvidentlyClient evidently = getEvidentlyLocalClient(); // EvaluateFeature via local client. EvaluateFeatureRequest evaluateFeatureRequest = new EvaluateFeatureRequest().builder() .withProject(${YOUR_PROJECT}) //Required. .withFeature(${YOUR_FEATURE}) //Required. .withEntityId(${YOUR_ENTITY_ID}) //Required. .withEvaluationContext(${YOUR_EVAL_CONTEXT}) //Optional: a JSON object of attributes that you can optionally pass in as part of the evaluation event sent to Evidently. .build(); EvaluateFeatureResponse evaluateFeatureResponse = evidently.evaluateFeature(evaluateFeatureRequest); // PutProjectEvents via local client. PutProjectEventsRequest putProjectEventsRequest = new PutProjectEventsRequest().builder() .withData(${YOUR_DATA}) Create projects, features, launches, and experiments 1955 Amazon CloudWatch User Guide .withTimeStamp(${YOUR_TIMESTAMP}) .withType(${YOUR_TYPE}) .build(); PutProjectEvents putProjectEventsResponse = evidently.putProjectEvents(putProjectEventsRequest); Configure how often the client sends data to Evidently To specify how often client-side evaluation sends data to Evidently, you can optionally configure two environment variables. • AWS_APPCONFIG_EXTENSION_EVIDENTLY_EVENT_BATCH_SIZE specifies the number of events per project to batch before sending them to Evidently. Valid values are integers between 1 and 50, and the default is 40. • AWS_APPCONFIG_EXTENSION_EVIDENTLY_BATCH_COLLECTION_DURATION specifies the duration in seconds to wait for events before sending them to Evidently. The default is 30. Troubleshooting Use the following information to help troubleshoot problems with using CloudWatch Evidently with client-side evaluation - powered by AWS AppConfig. An error occurred (BadRequestException) when calling the EvaluateFeature operation: HTTP method not supported for provided path Your environment variables might be configured incorrectly. For example, you might have used EVIDENTLY_CONFIGURATIONS as the environment variable name instead of AWS_APPCONFIG_EXTENSION_EVIDENTLY_CONFIGURATIONS. ResourceNotFoundException: Deployment not found Your update to the project metadata has not been deployed to AWS AppConfig. Check for an active deployment in the AWS AppConfig environment that you used for client-side evaluation. ValidationException: No Evidently configuration for project Your AWS_APPCONFIG_EXTENSION_EVIDENTLY_CONFIGURATIONS environment variable might be configured with the incorrect project name. Create projects, features, launches, and experiments 1956 Amazon CloudWatch Add a feature to a project Important User Guide End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. A feature in CloudWatch Evidently represents a feature that you want to launch or that you want to test variations of. Before you can add a feature, you must create a project. For more information, see Create a new project. To add a feature to a project 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the name of the project. 4. Choose Add feature. 5. For
acw-ug-522
acw-ug.pdf
522
will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. A feature in CloudWatch Evidently represents a feature that you want to launch or that you want to test variations of. Before you can add a feature, you must create a project. For more information, see Create a new project. To add a feature to a project 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the name of the project. 4. Choose Add feature. 5. For Feature name, enter a name to be used to identify this feature within this project. You can optionally add a feature description. 6. For Feature variations, for Variation type choose Boolean, Long, Double, or String. For more information, see Variation types. 7. Add up to five variations for your feature. The Value for each variation must be valid for the Variation type that you selected. Specify one of the variations to be the default. This is the baseline that the other variations will be compared to, and should be the variation that is being served to your users now. This is also the variation that is served to users who are not added to a launch or experiment for this feature. 8. Choose Sample code. The code example shows what you need to add to your application to set up the variations and assign user sessions to them. You can choose between JavaScript, Java, and Python for the code. Create projects, features, launches, and experiments 1957 Amazon CloudWatch User Guide You don't need to add the code to your application right now, but you must do so before you start a launch or an experiment. For more information, see Adding code to your application. 9. (Optional) To specify that certain users always see a certain variation, choose Overrides, Add override. Then, specify a user by entering their user ID, account ID, or some other identifier in Identifier, and specify which variation they should see. This can be useful for members of your own testing team or other internal users when you want to make sure they see a specific variation. The sessions of users who are assigned overrides do not contribute to launch or experiment metrics. You can repeat this for as many as 20 users by choosing Add override again. 10. (Optional) To add tags to this feature, choose Tags, Add new tag. Then, for Key, enter a name for the tag. You can add an optional value for the tag in Value. To add another tag, choose Add new tag again. For more information, see Tagging AWS Resources. 11. Choose Add feature. Variation types When you create a feature and define the variations, you must select a variation type. The possible types are: • Boolean • Long integer • Double precision floating-point number • String The variation type sets how the different variations are differentiated in your code. You can use the variation type to simplify the implementation of CloudWatch Evidently and also to simplify the process of modifying the features in your launches and experiments. Create projects, features, launches, and experiments 1958 Amazon CloudWatch User Guide For example, if you define a feature with the long integer variation type, the integers that you specify to differentiate the variations can be numbers passed directly into your code. One example might be testing the pixel size of a button The values for the variation types can be the number of pixels used in each variation. The code for each variation can read the variation type value and use that as the button size. To test a new button size, you can change the number used for the value of the variation, without making any other code changes. When you set the values for your variation types within a feature, you should avoid assigning the same values to multiple variations, unless you want to do A/A testing to initially try out CloudWatch Evidently, or have other reasons to do so. Evidently doesn't have native support for JSON as a type, but you can pass in JSON in the String variation type, and parse that JSON in your code. Use segments to focus your audience Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. You can define audience segments and use them in your launches and experiments. A segment is a portion of your audience that shares one or more characteristics. Examples could be Chrome browser users, users in Europe, or Firefox browser users in Europe who also fit other criteria that your application collects, such
acw-ug-523
acw-ug.pdf
523
type, and parse that JSON in your code. Use segments to focus your audience Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. You can define audience segments and use them in your launches and experiments. A segment is a portion of your audience that shares one or more characteristics. Examples could be Chrome browser users, users in Europe, or Firefox browser users in Europe who also fit other criteria that your application collects, such as age. Using a segment in an experiment limits that experiment to evaluating only the users who match the segment criteria. When you use one or more segments in a launch, you can define different traffic splits for the different audience segments. Segment rule pattern syntax To create a segment, define a segment rule pattern. Specify the attributes that you want to use to evaluate whether a user session will be in the segment. The pattern that you create is compared to the value of evaluationContext that Evidently finds in a user session. For more information, see Using EvaluateFeature. Create projects, features, launches, and experiments 1959 Amazon CloudWatch User Guide To create an segment rule pattern, specify the fields that you want the pattern to match. You can also use logic in your pattern, such as And, Or, Not and Exists. For an evaluationContext to match a pattern, the evaluationContext must match all parts of the rule pattern. Evidently ignores the fields in the evaluationContext that aren't included in the rule pattern. The values that rule patterns match follow JSON rules. You can include strings enclosed in quotation marks ("), numbers, and the keywords true, false, and null. For strings, Evidently uses exact character-by-character matching without case-folding or any other string normalization. Therefore, rule matches are case-sensitive. For example, if your evaluationContext includes a browser attribute but your rule pattern checks for Browser, it will not match. For numbers, Evidently uses string representation. For example, 300, 300.0, and 3.0e2 are not considered equal. When you write rule patterns to match evaluationContext, you can use the TestSegmentPattern API or the test-segment-pattern CLI command to test that your pattern matches the correct JSON. For more information, see TestSegmentPattern. The following summary shows all the comparison operators that are available in Evidently segment patterns. Comparison Example Rule syntax Null UserID is null Empty LastName is empty Equals Browser is "Chrome" { "UserID": [ null ] } { "LastName": [""] } { "Browser": [ "Chrome" ] Create projects, features, launches, and experiments 1960 Amazon CloudWatch User Guide Comparison Example Rule syntax } And Country is "France" and Device is "Mobile" Or (multiple values of a single attribute) Browser is "Chrome" or "Firefox" Or (different attributes) Browser is "Safari" or Device is "Tablet" Not Browser is anything but "Safari" Numeric (equals) Price is 100 { "Country": [ "France" ], "Device": ["Mobile"] } { "Browser": ["Chrome", "Firefox"] } { "$or": [ {"Browser": ["Safari"]}, {"Device": ["Tablet" }] ] } { "Browser": [ { "anything-but": [ "Safari" ] } ] } { "Price": [ { "numeric": [ "=", 100 ] } ] } Create projects, features, launches, and experiments 1961 Amazon CloudWatch User Guide Comparison Example Rule syntax Numeric (range) Price is more than 10, and less than or equal to 20 Exists Age field exists Does not exist Age field does not exist Begins with a prefix Region is in the United States Ends with a suffix Location has a suffix "West" { "Price": [ { "numeric": [ ">", 10, "<=", 20 ] } ] } { "Age": [ { "exists": true } ] } { "Age": [ { "exists": false } ] } { "Region": [ {"prefix": "us-" } ] } { "Region": [ {"suffix": "West" } ] } Segment rule examples All of the following examples assume that you are passing values for evaluationContext with the same field labels and values that you are using in your rule patterns. The following example matches if Browser is Chrome or Firefox and Location is US-West. { Create projects, features, launches, and experiments 1962 Amazon CloudWatch User Guide "Browser": ["Chrome", "Firefox"], "Location": ["US-West"] } The following example matches if Browser is any browser except Chrome, the Location starts with US, and an Age field exists. { "Browser": [ {"anything-but": ["Chrome"]}], "Location": [{"prefix": "US"}], "Age": [{"exists": true}] } The following example matches if the Location is Japan and either Browser is Safari or Device is Tablet. { "Location": ["Japan"], "$or": [ {"Browser": ["Safari"]}, {"Device": ["Tablet"]} ] } Create a segment After you create a segment, you can use it in any launch or experiment in any project. To create a segment 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2.
acw-ug-524
acw-ug.pdf
524
"Browser": ["Chrome", "Firefox"], "Location": ["US-West"] } The following example matches if Browser is any browser except Chrome, the Location starts with US, and an Age field exists. { "Browser": [ {"anything-but": ["Chrome"]}], "Location": [{"prefix": "US"}], "Age": [{"exists": true}] } The following example matches if the Location is Japan and either Browser is Safari or Device is Tablet. { "Location": ["Japan"], "$or": [ {"Browser": ["Safari"]}, {"Device": ["Tablet"]} ] } Create a segment After you create a segment, you can use it in any launch or experiment in any project. To create a segment 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the Segments tab. 4. Choose Create segment. 5. For Segment name, enter a name to use to identify this segment. Optionally, add a description. 6. For Segment pattern, enter a JSON block that defines the rule pattern. For more information about rule pattern syntax, see Segment rule pattern syntax. Create projects, features, launches, and experiments 1963 Amazon CloudWatch Create a launch Important User Guide End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. To expose a new feature or change to a specified percentage of your users, create a launch. You can then monitor key metrics such as page load times and conversions before you roll out the feature to all of your users. Before you can add a launch, you must have created a project. For more information, see Create a new project. When you add a launch, you can use a feature that you have already created, or create a new feature while you create the launch. To add a launch to a project 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. 4. In the navigation pane, choose Application Signals, Evidently. Select the button next to the name of the project and choose Project actions, Create launch. For Launch name, enter a name to be used to identify this feature within this project. You can optionally add a description. 5. Choose either Select from existing features or Add new feature. If you are using an existing feature, select it under Feature name. If you choose Add new feature, do the following: a. b. c. For Feature name, enter a name to be used to identify this feature within this project. You can optionally add a description. For Feature variations, for Variation type choose Boolean, Long, Double, or String. For more information, see Variation types. Add up to five variations for your feature. The Value for each variation must be valid for the Variation type that you selected. Create projects, features, launches, and experiments 1964 Amazon CloudWatch User Guide Specify one of the variations to be the default. This is the baseline that the other variations will be compared to, and should be the variation that is being served to your users now. If you stop an experiment, this default variation will then be served to all users. d. Choose Sample code. The code example shows what you need to add to your application to set up the variations and assign user sessions to them. You can choose between JavaScript, Java, and Python for the code. You don't need to add the code to your application right now, but you must do so before you start the launch. For more information, see Adding code to your application. 6. 7. For Launch configuration, choose whether to start the launch immediately or schedule it to start later. (Optional) To specify different traffic splits for audience segments that you have defined, instead of the traffic split that you will use for your general audience, choose Add Segment Overrides. In Segment Overrides, select a segment and define the traffic split to use for that segment. You can optionally define more segments to define traffic splits for by choosing Add Segment Override. A launch can have up to six segment overrides. For more information, see Use segments to focus your audience. 8. For Traffic configuration, select the traffic percentage to assign to each variation for the general audience that doesn't match the segment overrides. You can also choose to exclude variations from being served to users. The Traffic summary shows how much of your overall traffic is available for this launch. 9. If you choose to schedule the launch to start later, you can add multiple steps to the launch. Each step can use different percentages for serving the variations. To do this, choose Add another step and then specify the schedule and traffic percentages for the next step. You can include as many as five steps in a launch. 10. If you want to track your feature performance
acw-ug-525
acw-ug.pdf
525
doesn't match the segment overrides. You can also choose to exclude variations from being served to users. The Traffic summary shows how much of your overall traffic is available for this launch. 9. If you choose to schedule the launch to start later, you can add multiple steps to the launch. Each step can use different percentages for serving the variations. To do this, choose Add another step and then specify the schedule and traffic percentages for the next step. You can include as many as five steps in a launch. 10. If you want to track your feature performance with metrics during the launch, choose Metrics, Add metric. You can use either CloudWatch RUM metrics or custom metrics. To use a custom metric, you can create the metric here using an Amazon EventBridge rule. To create a custom metric, do the following: Create projects, features, launches, and experiments 1965 Amazon CloudWatch User Guide • Choose Custom metrics and enter a name for the metric. • Under Metric rule, for Entity ID, enter the way to identify the entity. This can be a user or session that does an action that causes a metric value to be recorded. An example is userDetails.userID. • For Value key, enter the value that is to be tracked to produce the metric. • Optionally, enter a name for the units for the metric. This unit name is for display purposes only, for use on graphs in the Evidently console. As you enter those fields, the box shows examples of how to code the EventBridge rule to create the metric. For more information about EventBridge, see What Is Amazon EventBridge? To use RUM metrics, you must already have a RUM app monitor set up for your application. For more information, see Set up an application to use CloudWatch RUM. Note If you use RUM metrics, and the app monitor is not configured to sample 100% of user sessions, then not all of the user sessions that participate in the launch will send metrics to Evidently. To ensure that the launch metrics are accurate, we recommend that the app monitor uses 100% of user sessions for sampling. 11. (Optional) If you create at least one metric for the launch, you can associate an existing CloudWatch alarm with this launch. To do so, choose Associate CloudWatch alarms. When you associate an alarm with a launch, CloudWatch Evidently must add tags to the alarm with the project name and launch name. This is so that CloudWatch Evidently can display the correct alarms in the launch information in the console. To acknowledge that CloudWatch Evidently will add these tags, choose Allow Evidently to tag the alarm resource identified below with this launch resource. Then, choose Associate alarm and enter the alarm name. For information about creating CloudWatch alarms, see Using Amazon CloudWatch alarms. 12. (Optional) To add tags to this launch, choose Tags, Add new tag. Then, for Key, enter a name for the tag. You can add an optional value for the tag in Value. Create projects, features, launches, and experiments 1966 Amazon CloudWatch User Guide To add another tag, choose Add new tag again. For more information, see Tagging AWS Resources. 13. Choose Create launch. Create an experiment Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. Use experiments to test different versions of a feature or website and collect data from real user sessions. This way, you can make choices for your application based on evidence and data. Before you can add an experiment, you must have created a project. For more information, see Create a new project. When you add an experiment, you can use a feature that you have already created, or create a new feature while you create the experiment. To add an experiment to a project 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Application Signals, Evidently. Select the button next to the name of the project and choose Project actions, Create experiment. 4. For Experiment name, enter a name to be used to identify this feature within this project. You can optionally add a description. 5. Choose either Select from existing features or Add new feature. If you are using an existing feature, select it under Feature name. If you choose Add new feature, do the following: Create projects, features, launches, and experiments 1967 Amazon CloudWatch User Guide a. b. c. For Feature name, enter a name to be used to identify this feature within this project. You can also optionally enter a description. For Feature variations, for Variation type choose Boolean, Long, Double, or String. The type defines which
acw-ug-526
acw-ug.pdf
526
be used to identify this feature within this project. You can optionally add a description. 5. Choose either Select from existing features or Add new feature. If you are using an existing feature, select it under Feature name. If you choose Add new feature, do the following: Create projects, features, launches, and experiments 1967 Amazon CloudWatch User Guide a. b. c. For Feature name, enter a name to be used to identify this feature within this project. You can also optionally enter a description. For Feature variations, for Variation type choose Boolean, Long, Double, or String. The type defines which type of value is used for each variation. For more information, see Variation types. Add up to five variations for your feature. The Value for each variation must be valid for the Variation type that you selected. Specify one of the variations to be the default. This is the baseline that the other variations will be compared to, and should be the variation that is being served to your users now. If you stop an experiment that uses this feature, the default variation is then served to the percentage of users that were in the experiment previously. d. Choose Sample code. The code example shows what you need to add to your application to set up the variations and assign user sessions to them. You can choose between JavaScript, Java, and Python for the code. You don't need to add the code to your application right now, but you must do so before you start the experiment. For more information, see Adding code to your application. 6. 7. For Audience, optionally select a segment that you have created if you want this experiment to apply only to the users who match that segment. For more information about segments, see Use segments to focus your audience. For Traffic split for the experiment, specify the percentage of the selected audience whose sessions will be used in the experiment. Then allocate the traffic for the different variations that the experiment uses. If a launch and an experiment are both running at the same time for the same feature, the audience is first directed to the launch. Then, the percentage of traffic specified for the launch is taken from the overall audience. After that, the percentage that you specify here is the percentage of the remaining audience that is used for the experiment. Any remaining traffic after that is served the default variation. 8. For Metrics, choose the metrics to use to evaluate the variations during the experiment. You must use at least one metric for evaluation. a. For Metric source, choose whether to use CloudWatch RUM metrics or custom metrics. Create projects, features, launches, and experiments 1968 Amazon CloudWatch User Guide b. Enter a name for the metric. For Goal, choose Increase if you want a higher value for the metric to indicate a better variation. Choose Decrease if you want a lower value for the metric to indicate a better variation. c. If you are using a custom metric, you can create the metric here using an Amazon EventBridge rule. To create a custom metric, do the following: • Under Metric rule, for Entity ID, enter a way to identify the entity, This can be a user or session that does an action that causes a metric value to be recorded. An example is userDetails.userID. • For Value key, enter the value that is to be tracked to produce the metric. • Optionally, enter a name for the units for the metric. This unit name is for display purposes only, for use on graphs in the Evidently console. You can use RUM metrics only if you have set up RUM to monitor this application. For more information, see CloudWatch RUM. Note If you use RUM metrics, and the app monitor is not configured to sample 100% of user sessions, then not all of the user sessions in the experiment will send metrics to Evidently. To ensure that the experiment metrics are accurate, we recommend that the app monitor uses 100% of user sessions for sampling. d. (Optional) To add more metrics to evaluate, choose Add metric. You can evaluate as many as three metrics during the experiment. 9. (Optional) To create CloudWatch alarms to use with this experiment, choose CloudWatch alarms. The alarms can monitor whether the difference in results between each variation and the default variation is larger than a threshold that you specify. If a variation's performance is worse than the default variation, and the difference is greater than your threshold, it goes into alarm state and notifies you. Creating an alarm here creates one alarm for each variation that is not the default variation. If you create an alarm, specify the following: • For Metric name, choose the experiment
acw-ug-527
acw-ug.pdf
527
three metrics during the experiment. 9. (Optional) To create CloudWatch alarms to use with this experiment, choose CloudWatch alarms. The alarms can monitor whether the difference in results between each variation and the default variation is larger than a threshold that you specify. If a variation's performance is worse than the default variation, and the difference is greater than your threshold, it goes into alarm state and notifies you. Creating an alarm here creates one alarm for each variation that is not the default variation. If you create an alarm, specify the following: • For Metric name, choose the experiment metric to use for the alarm. Create projects, features, launches, and experiments 1969 Amazon CloudWatch User Guide • For Alarm condition choose what condition causes the alarm to go into alarm state, when the variation metric values are compared to the default variation metric values. For example, choose Greater or Greater/Equal if higher numbers indicate for the variation indicates that it is performing poorly. This would be appropriate if the metric is measuring page load time, for example. • Enter a number for the threshold, which is the percentage difference in performance that will cause the alarm to go into ALARM state. • For Average over period, choose how much metric data for each variation is aggregated together before being compared. You can choose Add new alarm again to add more alarms to the experiment. Next, choose Set notifications for the alarm and select or create an Amazon Simple Notification Service topic to send alarm notifications to. For more information, see Setting up Amazon SNS notifications, 10. (Optional) To add tags to this experiment, choose Tags, Add new tag. Then, for Key, enter a name for the tag. You can add an optional value for the tag in Value. To add another tag, choose Add new tag again. For more information, see Tagging AWS Resources. 11. Choose Create experiment. 12. If you haven't already, build the feature variants into your application. 13. Choose Done. The experiment does not start until you start it. After you complete the steps in the following procedure, the experiment starts immediately. To start an experiment that you have created 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the name of the project. 4. Choose the Experiments tab. 5. Choose the button next to the name of the experiment, and choose Actions, Start experiment. Create projects, features, launches, and experiments 1970 Amazon CloudWatch User Guide 6. (Optional) To view or modify the experiment settings you made when you created it, choose Experiment setup. 7. Choose a time for the experiment to end. 8. Choose Start experiment. The experiment starts immediately. Manage features, launches, and experiments Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. Use the procedures in these sections to manage the features, launches, and experiments that you have created. Topics • See the current evaluation rules and audience traffic for a feature • Modify launch traffic • Modify a launch's future steps • Modify experiment traffic • Stop a launch • Stop an experiment See the current evaluation rules and audience traffic for a feature Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. Manage features, launches, and experiments 1971 Amazon CloudWatch User Guide You can use the CloudWatch Evidently console to see how the feature's evaluation rules are allocating the audience traffic among the feature's current launches, experiments, and variations. To view the audience traffic for a feature 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the name of the project that contains the feature. 4. Choose the Features tab. 5. Choose the name of the feature. In the Evaluation rules tab, you can see the flow of audience traffic for your feature, as follows: • First, the overrides are evaluated. These specify that certain users are always served a specific variation. The sessions of users who are assigned overrides do not contribute to launch or experiment metrics. • Next, the remaining traffic is available for the ongoing launch, if there is one. If there is a launch in progress, the table in the Launches section displays the launch name and the launch traffic split among the feature variations. On the right side of the Launches section, a Traffic indicator displays how much of the available audience (after overrides) is allocated to this launch. The rest of the traffic not allocated to the
acw-ug-528
acw-ug.pdf
528
that certain users are always served a specific variation. The sessions of users who are assigned overrides do not contribute to launch or experiment metrics. • Next, the remaining traffic is available for the ongoing launch, if there is one. If there is a launch in progress, the table in the Launches section displays the launch name and the launch traffic split among the feature variations. On the right side of the Launches section, a Traffic indicator displays how much of the available audience (after overrides) is allocated to this launch. The rest of the traffic not allocated to the launch flows to the experiment (if any) and then the default variation. • Next, the remaining traffic is available for the ongoing experiment, if there is one. If there is an experiment in progress, the table in the Experiments section displays the experiment name and progress. On the right side of the Experiments section, a Traffic indicator displays how much of the available audience (after overrides and launches) is allocated to this experiment. The rest of the traffic not allocated to the launch or the experiment is served the default variation of the feature. Manage features, launches, and experiments 1972 Amazon CloudWatch Modify launch traffic Important User Guide End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. You can modify the traffic allocation for a launch at any time, including while the launch is ongoing. If you have both an ongoing launch and an ongoing experiment for the same feature, any changes to the feature traffic will cause a change in the experiment traffic. This is because the audience available to the experiment is the portion of your total audience that is not already allocated to the launch. Increasing launch traffic will descrease the audience available to the experiment, and decreasing launch traffic or ending the launch will increase the audience available to the experiment. To modify the traffic allocation for a launch 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the name of the project that contains the launch. 4. Choose the Launches tab. 5. Choose the name of the launch. Choose Modify launch traffic. 6. For Serve, select the new traffic percentage to assign to each variation. You can also choose to exclude variations from being served to users. As you change these values, you can see the updated effects on your overall feature traffic under Traffic summary. The Traffic summary shows how much of your overall traffic is available for this launch, and how much of that available traffic is allocated to this launch. 7. Choose Modify. Manage features, launches, and experiments 1973 Amazon CloudWatch User Guide Modify a launch's future steps Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. You can modify the configuration of launch steps that haven't happened yet, and also add more steps to a launch. To modify the steps for a launch 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the name of the project that contains the launch. 4. Choose the Launches tab. 5. Choose the name of the launch. Choose Modify launch traffic. 6. Choose Schedule launch. 7. For any steps that have not started yet, you can modify the percentage of the available audience to use in the experiment. You can also modify how their traffic is allocated among the variations. You can add more steps to the launch by choosing Add another step. A launch can have a maximum of five steps. 8. Choose Modify. Manage features, launches, and experiments 1974 Amazon CloudWatch Modify experiment traffic Important User Guide End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. You can modify the sampling rate for an experiment at any time, including while the experiment is ongoing. However, you can't update the treatment weights after an experiment is running. Therefore, you can change the total traffic exposed to the experiment after an experiment is running, but not the relative allocation to each treatment. If you modify the traffic of an ongoing experiment, we recommend that you only increase the traffic allocation, so that you don't introduce bias. The following diagram shows how client traffic is allocated to different variations in an experiment. In this experiment, the sampling rate is 10% and the treatment weights for
acw-ug-529
acw-ug.pdf
529
for an experiment at any time, including while the experiment is ongoing. However, you can't update the treatment weights after an experiment is running. Therefore, you can change the total traffic exposed to the experiment after an experiment is running, but not the relative allocation to each treatment. If you modify the traffic of an ongoing experiment, we recommend that you only increase the traffic allocation, so that you don't introduce bias. The following diagram shows how client traffic is allocated to different variations in an experiment. In this experiment, the sampling rate is 10% and the treatment weights for the two variations are 50% each. Manage features, launches, and experiments 1975 Amazon CloudWatch User Guide To modify the traffic allocation for an experiment 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application monitoring, Evidently. 3. Choose the name of the project that contains the launch. 4. Choose the Experiments tab. 5. Choose the name of the launch. 6. Choose Modify experiment traffic. 7. Enter a percentage or use the slider to specify how much of the available traffic to allocate to this experiment. The available traffic is the total audience minus the traffic that is allocated to a current launch, if there is one. The traffic that is not allocated to the launch or experiment is served the default variation. 8. Choose Modify. Manage features, launches, and experiments 1976 Amazon CloudWatch Stop a launch Important User Guide End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. If you stop an ongoing launch, you will not be able to resume it or restart it. Also, it will not be evaluated as a rule for traffic allocation, and the traffic that was allocated to the launch will instead be available to the feature's experiment, if there is one. Otherwise, all traffic will be served the default variation after the launch is stopped. To permanently stop a launch 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the name of the project that contains the launch. 4. Choose the Launch tab. 5. Choose the button to the left of the name of the launch. 6. Choose Actions, Cancel launch or Actions, Mark as complete. Stop an experiment Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. If you stop an ongoing experiment, you will not be able to resume it or restart it. The portion of traffic that was previously used in the experiment will be served the default variation. When an experiment is not manually stopped and passes its end date, the traffic does not change. The portion of traffic allocated to the experiment still goes to the experiment. To stop this, and Manage features, launches, and experiments 1977 Amazon CloudWatch User Guide cause the experiment traffic to instead be served the default variation, mark the experiment as complete. When you stop an experiment, you can choose to cancel it or mark it as complete. If you cancel, it will be shown as Cancelled in the list of experiments. If you choose to mark it as complete, it is shown as Completed. To permanently stop an experiment 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the name of the project that contains the experiment. 4. Choose the Experiments tab. 5. Choose the button to the left of the name of the experiment. 6. Choose Actions, Cancel experiment or Actions, Mark as complete. Adding code to your application Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. To work with CloudWatch Evidently, you add code to your application to assign a variation to each user session, and to send metrics to Evidently. You use the CloudWatch Evidently EvaluateFeature operation to assign variations to user sessions, and you use the PutProjectEvents operation to send events to Evidently to be used to calculate metrics for your launches or experiments. When you create variations or custom metrics, the CloudWatch Evidently console provides samples of the code you need to add. For an end-to-end example, see Tutorial: A/B testing with the Evidently sample application. Adding code to your application 1978 Amazon CloudWatch Using EvaluateFeature User Guide When feature variations are used in a launch or experiment, the application uses the EvaluateFeature operation to assign each user session a
acw-ug-530
acw-ug.pdf
530
the CloudWatch Evidently EvaluateFeature operation to assign variations to user sessions, and you use the PutProjectEvents operation to send events to Evidently to be used to calculate metrics for your launches or experiments. When you create variations or custom metrics, the CloudWatch Evidently console provides samples of the code you need to add. For an end-to-end example, see Tutorial: A/B testing with the Evidently sample application. Adding code to your application 1978 Amazon CloudWatch Using EvaluateFeature User Guide When feature variations are used in a launch or experiment, the application uses the EvaluateFeature operation to assign each user session a variation. The assignment of a variation to a user is an evaluation event. When you call this operation, you pass in the following: • Feature name– Required. Evidently processes the evaluation according to the feature evaluation rules of the launch or experiment, and selects a variation for the entity. • entityId– Required. Represents a unique user. • evaluationContext– Optional. A JSON object representing additional information about a user. Evidently will use this value to match the user to a segment of your audience during feature evaluations, if you have created segments. For more information, see Use segments to focus your audience. The following is an example of an evaluationContext value that you can send to Evidently. { "Browser": "Chrome", "Location": { "Country": "United States", "Zipcode": 98007 } } Sticky evaluations CloudWatch Evidently uses "sticky" evaluations. A single configuration of entityId, feature, feature configuration, and evaluationContext always receives the same variation assignment. The only time this variation assignment changes is when an entity is added to an override or the experiment traffic is dialed up. A feature configuration includes the following: • The feature variations • The variation configuration (percentages assigned to each variation) for a currently running experiment for this feature, if any. • The variation configuration for a currently running launch for this feature, if any. The variation configuration includes the defined segment overrides, if any. Adding code to your application 1979 Amazon CloudWatch User Guide If an experiment's traffic allocation is increased, any entityId that was previously assigned to an experiment treatment group will continue to receive the same treatment. Any entityId that was previously assigned to the control group, might be assigned to an experiment treatment group, according to the variation configuration specified for the experiment. If an experiment's traffic allocation is decreased, an entityId might go from a treatment group to a control group, but it will not go into a different treatment group. Using PutProjectEvents To code a custom metric for Evidently, you use the PutProjectEvents operation. The following is a simple payload example. { "events": [ { "timestamp": {{$timestamp}}, "type": "aws.evidently.custom", "data": "{\"details\": {\"pageLoadTime\": 800.0}, \"userDetails\": {\"userId\": \"test-user\"}}" } ] } The entityIdKey can just be an entityId or you can rename it to anything else, such as userId. In the actual event, entityId can be a username, a session ID, and so on. "metricDefinition":{ "name": "noFilter", "entityIdKey": "userDetails.userId", //should be consistent with jsonValue in events "data" fields "valueKey": "details.pageLoadTime" }, To ensure that events are associated with the correct launch or experiment, you must pass the same entityId when you call both EvaluateFeature and PutProjectEvents. Be sure to call PutProjectEvents after the EvaluateFeature call, otherwise data is dropped and won't be used by CloudWatch Evidently. The PutProjectEvents operation does not require the feature name as an input parameter. This way, you can use a single event in multiple experiments. For example, suppose you call Adding code to your application 1980 Amazon CloudWatch User Guide EvaluateFeature with the entityId set to userDetails.userId. If you have two or more experiments running, you can have a single event from that user's session emit metrics for each of those experiments. To do this, you call PutProjectEvents once for each experiment, using that same entityId. Timing After your application calls EvaluateFeature, there is a one-hour time period where metric events from PutProjectEvents are attributed based on that evaluation. If any more events occur after the one-hour period, they are not attributed. However, if the same entityId is used for a new EvaluateFeature call during that initial call's one-hour window, the later EvaluateFeature result is now used instead, and the one-hour timer is restarted. This can only happen in certain circumstances, such as when experiment traffic is dialed up between the two assignments, as explained in the previous Sticky evaluations section. For an end-to-end example, see Tutorial: A/B testing with the Evidently sample application. Evidently project data storage in CloudWatch Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. Evidently collects two types of events: • Evaluation events are related to which feature variation
acw-ug-531
acw-ug.pdf
531
the one-hour timer is restarted. This can only happen in certain circumstances, such as when experiment traffic is dialed up between the two assignments, as explained in the previous Sticky evaluations section. For an end-to-end example, see Tutorial: A/B testing with the Evidently sample application. Evidently project data storage in CloudWatch Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. Evidently collects two types of events: • Evaluation events are related to which feature variation is assigned to a user session. Evidently uses these events to produce metrics and other experiment and launch data, which you can view in the Evidently console. You can also choose to store these evaluation events in Amazon CloudWatch Logs or Amazon S3. • Custom events are used to generate metrics from user actions such as clicks and checkouts. Evidently doesn't provide a method for you to store custom events. If you want to save them, you must modify your application code to send them to a storage option outside of Evidently. Project data storage 1981 Amazon CloudWatch User Guide Format of evaluation event logs If you choose to store evaluation events in CloudWatch Logs or Amazon S3, each evaluation event is stored as a log event with the following format: { "event_timestamp": 1642624900215, "event_type": "evaluation", "version": "1.0.0", "project_arn": "arn:aws:evidently:us-east-1:123456789012:project/petfood", "feature": "petfood-upsell-text", "variation": "Variation1", "entity_id": "7", "entity_attributes": {}, "evaluation_type": "EXPERIMENT_RULE_MATCH", "treatment": "Variation1", "experiment": "petfood-experiment-2" } Here are more details about the preceding evaluation event format: • The timestamp is in UNIX time with milliseconds • The variation is the name of the variation of the feature which was assigned to this user session. • The entity ID is a string. • Entity attributes are a hash of arbitrary values sent by the client. For example, if the entityId is mapped to blue or green, then you can optionally send userIDs, session data, or whatever else that you want want from a correlation and data warehouse perspective. IAM policy and encryption for evaluation event storage in Amazon S3 If you choose to use Amazon S3 to store evaluation events, you must add an IAM policy like the following to allow Evidently to publish logs to the Amazon S3 bucket. This is because Amazon S3 buckets and the objects they contain are private, and they don't allow access to other services by default. { "Version": "2012-10-17", "Statement": [ { "Sid": "AWSLogDeliveryWrite", Project data storage 1982 Amazon CloudWatch User Guide "Effect": "Allow", "Principal": {"Service": "delivery.logs.amazonaws.com"}, "Action": "s3:PutObject", "Resource": "arn:aws:s3:::bucket_name/optional_folder/AWSLogs/account_id/ *", "Condition": {"StringEquals": {"s3:x-amz-acl": "bucket-owner-full- control"}} }, { "Sid": "AWSLogDeliveryCheck", "Effect": "Allow", "Principal": {"Service": "delivery.logs.amazonaws.com"}, "Action": ["s3:GetBucketAcl", "s3:ListBucket"], "Resource": "arn:aws:s3:::bucket_name" } ] } If you store Evidently data in Amazon S3, you can also choose to encrypt it with Server-Side Encryption with AWS Key Management Service Keys (SSE-KMS). For more information, see Protecting data using server-side encryption. If you use a customer managed key from AWS KMS, you must add the following to the IAM policy for your key. This allows Evidently to write to the bucket. { "Sid": "AllowEvidentlyToUseCustomerManagedKey", "Effect": "Allow", "Principal": { "Service": [ "delivery.logs.amazonaws.com" ] }, "Action": [ "kms:Encrypt", "kms:Decrypt", "kms:ReEncrypt*", "kms:GenerateDataKey*", "kms:DescribeKey" ], "Resource": "*" } Project data storage 1983 Amazon CloudWatch User Guide How Evidently calculates results Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. You can use Amazon CloudWatch Evidently A/B testing as a tool for data-driven decision making. In an A/B test, users are randomly assigned to either the control group (also called the default variation), or one of the treatment groups (also called the tested variations). For example, users in the control group might experience the website, service, or application in the same way that they did before the experiment started. Meanwhile, users in the treatment group might experience the change. CloudWatch Evidently supports up to five different variations in an experiment. Evidently randomly assigns traffic to these variations. This way, you can track business metrics (such as revenue) and performance metrics (such as latency) for each group. Evidently does the following: • Compares the treatment with the control. (For example, compares whether revenue increases or decreases with a new checkout process.) • Indicates whether the observed difference between the treatment and the control is significant. For this, Evidently offers two approaches: Frequentist significance levels and Bayesian probabilities. Why use Frequentist and Bayesian approaches? Consider a case where the treatment has no effect compared to the control, or a case where the treatment is identical to the control (an A/A test). You would still observe a small difference between the
acw-ug-532
acw-ug.pdf
532
performance metrics (such as latency) for each group. Evidently does the following: • Compares the treatment with the control. (For example, compares whether revenue increases or decreases with a new checkout process.) • Indicates whether the observed difference between the treatment and the control is significant. For this, Evidently offers two approaches: Frequentist significance levels and Bayesian probabilities. Why use Frequentist and Bayesian approaches? Consider a case where the treatment has no effect compared to the control, or a case where the treatment is identical to the control (an A/A test). You would still observe a small difference between the treatment and the control in the data. This is because the test participants consist of a finite sample of users, representing a small percentage of all users of the website, service, or application. Frequentist significance levels and Bayesian probabilities provide insights into whether the observed difference is significant or due to chance. Evidently considers the following to determine whether the observed difference is significant: • How big the difference is How Evidently calculates results 1984 Amazon CloudWatch User Guide • How many samples are part of the test • How the data is distributed Frequentist analysis in Evidently Evidently uses sequential testing, which avoids the usual problems of peeking, a common pitfall of frequentist statistics. Peeking is the practice of checking the results of an ongoing A/B test in order to stop it and make a decision based on the observed results. For more information about sequential testing, see Time-uniform, nonparametric, nonasymptotic confidence sequences by Howard et al. (Ann. Statist. 49 (2) 1055 - 1080, 2021). Because Evidently's results are valid at any time (anytime-valid results), you can peek at results during the experiment and still draw sound conclusions. This can reduce some of the costs of experimentation, because you can stop an experiment before the scheduled time if the results already have significance. Evidently generates anytime-valid significance levels and anytime-valid 95% confidence intervals of the difference between the tested variation and the default variation in the target metric. The Result column in the experiment results indicates the tested variation performance, which can be one of the following: • Inconclusive – The significance level is less than 95% • Better – The significance level is 95% or higher and one of the following is true: • The lower bound of the 95%-confidence interval is higher than zero and the metric should increase • The upper bound of the 95%-confidence interval is lower than zero and the metric should decrease • Worse – The significance level is 95% or higher and one of the following is true: • The upper bound of the 95%-confidence interval is higher than zero and the metric should increase • The lower bound of the 95%-confidence interval is lower than zero and the metric should decrease • Best – The experiment has two or more tested variations in addition to the default variation, and the following conditions are met: • The variation qualifies for the Better designation • One of the following is true: How Evidently calculates results 1985 Amazon CloudWatch User Guide • The lower bound of the 95%-confidence interval is higher than the upper bound of the 95%-confidence intervals of all the other variations and the metric should increase • The upper bound of the 95%-confidence interval is lower than the lower bound of the 95%- confidence intervals of all the other variations and the metric should decrease Bayesian analysis in Evidently With Bayesian analysis, you can calculate the probability that the mean in the tested variation is larger or smaller than the mean in the default variation. Evidently performs Bayesian inference for the mean of the target metric by using conjugate priors. With conjugate priors, Evidently can more efficiently infer the posterior distribution needed for the Bayesian analysis. Evidently waits until the end date of the experiment to compute the results of the Bayesian analysis. The results page displays the following: • probability of increase – The probability that the mean of the metric in the tested variation is at least 3% larger than the mean in the default variation • probability of decrease – The probability that the mean of the metric in the tested variation is at least 3% smaller than the mean in the default variation • probability of no change – The probability that the mean of the metric in the tested variation lies within ±3% of the mean in the default variation The Result column indicates the performance of the variation, and can be one of the following: • Better – The probability of increase is at least 90% and the metric should increase, or the probability of decrease is at least 90% and the metric should decrease • Worse – The probability of decrease is at least
acw-ug-533
acw-ug.pdf
533
in the tested variation is at least 3% smaller than the mean in the default variation • probability of no change – The probability that the mean of the metric in the tested variation lies within ±3% of the mean in the default variation The Result column indicates the performance of the variation, and can be one of the following: • Better – The probability of increase is at least 90% and the metric should increase, or the probability of decrease is at least 90% and the metric should decrease • Worse – The probability of decrease is at least 90% and the metric should increase, or the probability of increase is at least 90% and the metric should decrease How Evidently calculates results 1986 Amazon CloudWatch User Guide View launch results in the dashboard Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. You can see the progress and metric results of an experiment while it is ongoing and after it is completed. To see the progress and results of a launch 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the name of the project that contains the launch. 4. Choose the Launch tab. 5. Choose the name of the launch. 6. 7. To see the launch steps and the traffic allocations for each step, choose the Launch tab. To see the number of user sessions assigned to each variation over time, and to view the performance metrics for each variation in the launch, choose the Monitoring tab. This view also displays whether any launch alarms have gone into ALARM state during the launch. 8. To see the variations, metrics, alarms, and tags for this launch, choose the Configuration tab. View experiment results in the dashboard Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. View launch results in the dashboard 1987 Amazon CloudWatch User Guide You can see the statistical results of an experiment while it is ongoing and after it is completed. Experiment results are available up to 63 days after the start of the experiment. They are not available after that because of CloudWatch data retention policies. No statistical results are displayed until each variation has at least 100 events. Evidently performs an additional offline p-value analysis at the end of the experiment. Offline p- value analysis can detect statistical significance in some cases where the anytime p-values used during the experiment do not find statistical significance. For more information about how CloudWatch Evidently calculates experiment results, see How Evidently calculates results. To see the results of an experiment 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the name of the project that contains the experiment. 4. Choose the Experiments tab. 5. Choose the name of the experiment, and then choose the Results tab. 6. By Variation performance, there is a control where you can select which experiment statistics to display. If you select more than one statistic, Evidently displays a graph and table for each statistic. Each graph and table displays the results of the experiment so far. Each graph can display the following results. You can use the control at the right of the graph to determine which of the following items is displayed: • The number of user session events recorded for each variation. • The average value of the metric that is selected at the top of the graph, for each variation. • The statistical significance of the experiments. This compares the difference for the metric selected at the top of the graph with the default variation and each of the other variations. • The 95% upper and lower confidence bounds on the difference of the selected metric, between each of the variations and the default variation. The table displays a row for each variation. For each variation that is not the default, Evidently displays whether it has received enough data to declare the results statistically significant. It View experiment results in the dashboard 1988 Amazon CloudWatch User Guide also shows whether the variation's improvement in the statistical value has reached a 95% confidence level. Finally, in the Result column, Evidently provides a recommendation about which variation performs best based on this statistic, or whether the results are inconclusive. How CloudWatch Evidently collects and stores data Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able
acw-ug-534
acw-ug.pdf
534
default, Evidently displays whether it has received enough data to declare the results statistically significant. It View experiment results in the dashboard 1988 Amazon CloudWatch User Guide also shows whether the variation's improvement in the statistical value has reached a 95% confidence level. Finally, in the Result column, Evidently provides a recommendation about which variation performs best based on this statistic, or whether the results are inconclusive. How CloudWatch Evidently collects and stores data Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. Amazon CloudWatch Evidently collects and stores data related to project configurations so that customers can run experiments and launches. The data includes the following: • Metadata about projects, features, launches, and experiments • Metric events • Evaluation data Resource metadata is stored in Amazon DynamoDB. The data is encrypted at rest by default, using AWS owned keys. These keys are a collection of AWS KMS keys that an AWS service owns and manages for use in multiple AWS accounts. Customers can’t view, manage, or audit the use of these keys. Customers are also not required to take action or change programs to protect the keys that encrypt their data. For more information, see AWS owned keys in the AWS Key Management Service Developer Guide. Evidently metric events and evaluation events are delivered directly to customer-owned locations. Data in transit is automatically encrypted with HTTPS. This data will be delivered to customer- owned locations. You can also choose to store evaluation events in Amazon Simple Storage Service or Amazon CloudWatch Logs. For more information about how you can secure your data in these services, see How CloudWatch Evidently collects and stores data 1989 Amazon CloudWatch User Guide Enabling Amazon S3 default bucket encryption and Encrypting log data in CloudWatch Logs using AWS KMS. Retrieving data You can retrieve your data using CloudWatch Evidently APIs. To retrieve project data, use GetProject or ListProjects. To retrieve feature data, use GetFeature or ListFeatures. To retrieve launch data, use GetLaunch or ListLaunches. To retrieve experiment data, use GetExperiment, ListExperiments, or GetExperimentResults. Modifying and deleting data You can modify and delete your data using CloudWatch Evidently APIs. For project data, use UpdateProject or DeleteProject. For feature data, use UpdateFeature or DeleteFeature. For launch data, use UpdateLaunch or DeleteLaunch. For experiment data, use UpdateExperiment or DeleteExperiment. Using service-linked roles for Evidently Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. CloudWatch Evidently uses AWS Identity and Access Management (IAM) service-linked roles. A service-linked role is a unique type of IAM role that is linked directly to Evidently. Service-linked roles are predefined by Evidently and include all the permissions that the service requires to call other AWS services on your behalf. A service-linked role makes setting up Evidently easier because you don’t have to manually add the necessary permissions. Evidently defines the permissions of its service-linked roles, and unless defined otherwise, only Evidently can assume its roles. The defined permissions include the trust Using service-linked roles 1990 Amazon CloudWatch User Guide policy and the permissions policy, and that permissions policy cannot be attached to any other IAM entity. You can delete a service-linked role only after first deleting its related resources. This protects your Evidently resources because you can't inadvertently remove permission to access the resources. For information about other services that support service-linked roles, see AWS Services That Work with IAM and look for the services that have Yes in the Service-linked roles column. Choose a Yes with a link to view the service-linked role documentation for that service. Service-linked role permissions for Evidently Evidently uses the service-linked role named AWSServiceRoleForCloudWatchEvidently – Allows CloudWatch Evidently to manage associated AWS resourcees on behalf of the customer. The AWSServiceRoleForCloudWatchEvidently service-linked role trusts the following services to assume the role: • CloudWatch Evidently The role permissions policy named AmazonCloudWatchEvidentlyServiceRolePolicy allows Evidently to complete the following actions on the specified resources: • Actions: appconfig:StartDeployment, appconfig:StopDeployment, appconfig:ListDeployments, and appconfig:TagResource on Evidently thick clients. You must configure permissions to allow an IAM entity (such as a user, group, or role) to create, edit, or delete a service-linked role. For more information, see Service-linked role permissions in the IAM User Guide. Creating a service-linked role for Evidently You don't need to manually create a service-linked role. When you start using an Evidently thick client in the AWS Management Console, the AWS CLI, or the AWS API, Evidently creates the service- linked role for you. If you delete this service-linked role, and then need to create it again, you can use the
acw-ug-535
acw-ug.pdf
535
on Evidently thick clients. You must configure permissions to allow an IAM entity (such as a user, group, or role) to create, edit, or delete a service-linked role. For more information, see Service-linked role permissions in the IAM User Guide. Creating a service-linked role for Evidently You don't need to manually create a service-linked role. When you start using an Evidently thick client in the AWS Management Console, the AWS CLI, or the AWS API, Evidently creates the service- linked role for you. If you delete this service-linked role, and then need to create it again, you can use the same process to recreate the role in your account. When you start using an Evidently thick client, Evidently creates the service-linked role for you again. Using service-linked roles 1991 Amazon CloudWatch User Guide Editing a service-linked role for Evidently Evidently does not allow you to edit the AWSServiceRoleForCloudWatchEvidently service-linked role. After you create a service-linked role, you cannot change the name of the role because various entities might reference the role. However, you can edit the description of the role using IAM. For more information, see Editing a service-linked role in the IAM User Guide. Deleting a service-linked role for Evidently If you no longer need to use a feature or service that requires a service-linked role, we recommend that you delete that role. That way you don’t have an unused entity that is not actively monitored or maintained. However, you must clean up the resources for your service-linked role before you can manually delete it. You must delete all Evidently projects that are using thick clients. Note If the Evidently service is using the role when you try to delete the resources, then the deletion might fail. If that happens, wait for a few minutes and try the operation again. To delete Evidently resources used by AWSServiceRoleForCloudWatchEvidently 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. In the navigation pane, choose Application monitoring, Evidently. In the list of projects, select the check box next to the projects that used thick clients. 4. Choose Project actions, Delete project. To manually delete the service-linked role using IAM Use the IAM console, the AWS CLI, or the AWS API to delete the AWSServiceRoleForCloudWatchEvidently service-linked role. For more information, see Deleting a service-linked role in the IAM User Guide. Supported regions for Evidently service-linked roles Evidently supports using service-linked roles in all of the regions where the service is available. For more information, see AWS regions and endpoints. Using service-linked roles 1992 Amazon CloudWatch User Guide Evidently quotas in CloudWatch Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. CloudWatch Evidently has the following quotas. Resource Projects Default quota 50 per Region per account You can request a quota increase. Segments 500 per Region per account Quotas per project API quotas (all quotas are per Region) You can request a quota increase. • 100 total features • 500 total launches • 50 running launches • 500 total experiments • 50 running experiments You can request a quota increase for all of these quotas. • PutProjectEvents: 1000 transactions per second (TPS) in US East (N. Virginia), US West (Oregon), and Europe (Ireland). 200 TPS in all other Regions. • EvaluateFeature: 1000 TPS in US East (N. Virginia), US West (Oregon), and Europe (Ireland). 200 TPS in all other Regions. • BatchEvaluateFeature: 50 TPS Evidently quotas 1993 Amazon CloudWatch Resource User Guide Default quota • Create, Read, Update, Delete (CRUD) APIs: 10 TPS combined across all CRUD APIs You can request a quota increase for all of these quotas. Tutorial: A/B testing with the Evidently sample application Important End of support notice: On October 16, 2025, AWS will discontinue support for CloudWatch Evidently. After October 16, 2025, you will no longer be able to access the Evidently console or Evidently resources. This section provides a tutorial for using Amazon CloudWatch Evidently for A/B testing. This tutorial the Evidently sample application, which is a simple react application. The sample app will be configured to either display a showDiscount feature or not. When the feature is shown to a user, the price displayed on the shopping website it shown at a 20% discount. In addition to showing the discount to some users and not to others, in this tutorial you set up Evidently to collect page load time metrics from both variations. Warning This scenario requires IAM users with programmatic access and long-term credentials, which presents a security risk. To help mitigate this risk, we recommend that you provide these users with only the permissions they require to perform the task and that you remove these users when they are no longer
acw-ug-536
acw-ug.pdf
536
When the feature is shown to a user, the price displayed on the shopping website it shown at a 20% discount. In addition to showing the discount to some users and not to others, in this tutorial you set up Evidently to collect page load time metrics from both variations. Warning This scenario requires IAM users with programmatic access and long-term credentials, which presents a security risk. To help mitigate this risk, we recommend that you provide these users with only the permissions they require to perform the task and that you remove these users when they are no longer needed. Access keys can be updated if necessary. For more information, see Update access keys in the IAM User Guide. Step 1: Download the sample application Start by downloading the Evidently sample application. Tutorial: A/B testing with the Evidently sample application 1994 Amazon CloudWatch User Guide To download the sample application 1. Download the sample application from the following Amazon S3 bucket: https://evidently-sample-application.s3.us-west-2.amazonaws.com/evidently-sample- shopping-app.zip 2. Unzip the package. Step 2: Add the Evidently endpoint and set up credentials Next, add the Region and endpoint for Evidently to the config.js file in the src directory in the sample app package, as in the following example: evidently: { REGION: "us-west-2", ENDPOINT: "https://evidently.us-west-2.amazonaws.com (https://evidently.us- west-2.amazonaws.com/)", }, You also must make sure that the application has permission to call CloudWatch Evidently. To grant the sample app permissions to call Evidently 1. Federate to your AWS account. 2. Create an IAM user and attach the AmazonCloudWatchEvidentlyFullAccess policy to this user. 3. Make a note of the IAM user's access key id and secret access key, because you will need them in the next step. 4. In the same config.js file that you modified earlier in this section, enter the values of the access key ID and the secrect access key, as in the following example: credential: { accessKeyId: "Access key ID", secretAccessKey: "Secret key" } Tutorial: A/B testing with the Evidently sample application 1995 Amazon CloudWatch User Guide Important We use this step to make the sample app as simple as possible for you to try out. We do not recommend that you put your IAM user credential into your actual production application. Instead, we recommend that you use Amazon Cognito for authentication. For more information, see Integrating Amazon Cognito with web and mobile apps. Step 3: Set up code for the feature evaluation When you use CloudWatch Evidently to evaluate a feature, you must use the EvaluateFeature operation to randomly select a feature variation for each user session. This operation assigns user sessions to each variation of the feature, according to the percentages that you specified in the experiment. To set up the feature evaluation code for the bookstore demo app 1. Add the client builder in the src/App.jsx file so that the sample app can call Evidently. import Evidently from 'aws-sdk/clients/evidently'; import config from './config'; const defaultClientBuilder = ( endpoint, region, ) => { const credentials = { accessKeyId: config.credential.accessKeyId, secretAccessKey: config.credential.secretAccessKey } return new Evidently({ endpoint, region, credentials, }); }; 2. Add the following to the const App code section to initiate the client. if (client == null) { Tutorial: A/B testing with the Evidently sample application 1996 Amazon CloudWatch User Guide client = defaultClientBuilder( config.evidently.ENDPOINT, config.evidently.REGION, ); 3. Construct evaluateFeatureRequest by adding the following code. This code pre-fills the project name and feature name that we recommend later in this tutorial. You can substitute your own project and feature names, as long as you also specify those project and feature names in the Evidently console. const evaluateFeatureRequest = { entityId: id, // Input Your feature name feature: 'showDiscount', // Input Your project name' project: 'EvidentlySampleApp', }; 4. Add the code to call Evidently for feature evaluation. When the request is sent, Evidently randomly assigns the user session to either see the showDiscount feature or not. client.evaluateFeature(evaluateFeatureRequest).promise().then(res => { if(res.value?.boolValue !== undefined) { setShowDiscount(res.value.boolValue); } getPageLoadTime() }) Step 4: Set up code for the experiment metrics For the custom metric, use Evidently's PutProjectEvents API to send metric results to Evidently. The following examples show how to set up the custom metric and send experiment data to Evidently. Add the following function to calculate the page load time and use PutProjectEvents to send the metric values to Evidently. Add the following function to into Home.tsx and call this function within the EvaluateFeature API: const getPageLoadTime = () => { const timeSpent = (new Date().getTime() - startTime.getTime()) * 1.000001; Tutorial: A/B testing with the Evidently sample application 1997 Amazon CloudWatch User Guide const pageLoadTimeData = `{ "details": { "pageLoadTime": ${timeSpent} }, "UserDetails": { "userId": "${id}", "sessionId": "${id}"} }`; const putProjectEventsRequest = { project: 'EvidentlySampleApp', events: [ { timestamp: new Date(), type: 'aws.evidently.custom', data: JSON.parse(pageLoadTimeData) }, ], }; client.putProjectEvents(putProjectEventsRequest).promise(); } Here is what the App.js
acw-ug-537
acw-ug.pdf
537
calculate the page load time and use PutProjectEvents to send the metric values to Evidently. Add the following function to into Home.tsx and call this function within the EvaluateFeature API: const getPageLoadTime = () => { const timeSpent = (new Date().getTime() - startTime.getTime()) * 1.000001; Tutorial: A/B testing with the Evidently sample application 1997 Amazon CloudWatch User Guide const pageLoadTimeData = `{ "details": { "pageLoadTime": ${timeSpent} }, "UserDetails": { "userId": "${id}", "sessionId": "${id}"} }`; const putProjectEventsRequest = { project: 'EvidentlySampleApp', events: [ { timestamp: new Date(), type: 'aws.evidently.custom', data: JSON.parse(pageLoadTimeData) }, ], }; client.putProjectEvents(putProjectEventsRequest).promise(); } Here is what the App.js file should look like after all the editing that you have done since downloading it. import React, { useEffect, useState } from "react"; import { BrowserRouter as Router, Switch } from "react-router-dom"; import AuthProvider from "contexts/auth"; import CommonProvider from "contexts/common"; import ProductsProvider from "contexts/products"; import CartProvider from "contexts/cart"; import CheckoutProvider from "contexts/checkout"; import RouteWrapper from "layouts/RouteWrapper"; import AuthLayout from "layouts/AuthLayout"; import CommonLayout from "layouts/CommonLayout"; import AuthPage from "pages/auth"; import HomePage from "pages/home"; import CheckoutPage from "pages/checkout"; import "assets/scss/style.scss"; import { Spinner } from 'react-bootstrap'; import Evidently from 'aws-sdk/clients/evidently'; import config from './config'; const defaultClientBuilder = ( endpoint, Tutorial: A/B testing with the Evidently sample application 1998 Amazon CloudWatch region, ) => { const credentials = { accessKeyId: config.credential.accessKeyId, secretAccessKey: config.credential.secretAccessKey User Guide } return new Evidently({ endpoint, region, credentials, }); }; const App = () => { const [isLoading, setIsLoading] = useState(true); const [startTime, setStartTime] = useState(new Date()); const [showDiscount, setShowDiscount] = useState(false); let client = null; let id = null; useEffect(() => { id = new Date().getTime().toString(); setStartTime(new Date()); if (client == null) { client = defaultClientBuilder( config.evidently.ENDPOINT, config.evidently.REGION, ); } const evaluateFeatureRequest = { entityId: id, // Input Your feature name feature: 'showDiscount', // Input Your project name' project: 'EvidentlySampleApp', }; // Launch client.evaluateFeature(evaluateFeatureRequest).promise().then(res => { if(res.value?.boolValue !== undefined) { setShowDiscount(res.value.boolValue); } }); Tutorial: A/B testing with the Evidently sample application 1999 Amazon CloudWatch // Experiment User Guide client.evaluateFeature(evaluateFeatureRequest).promise().then(res => { if(res.value?.boolValue !== undefined) { setShowDiscount(res.value.boolValue); } getPageLoadTime() }) setIsLoading(false); },[]); const getPageLoadTime = () => { const timeSpent = (new Date().getTime() - startTime.getTime()) * 1.000001; const pageLoadTimeData = `{ "details": { "pageLoadTime": ${timeSpent} }, "UserDetails": { "userId": "${id}", "sessionId": "${id}"} }`; const putProjectEventsRequest = { project: 'EvidentlySampleApp', events: [ { timestamp: new Date(), type: 'aws.evidently.custom', data: JSON.parse(pageLoadTimeData) }, ], }; client.putProjectEvents(putProjectEventsRequest).promise(); } return ( !isLoading? ( <AuthProvider> <CommonProvider> <ProductsProvider> <CartProvider> <CheckoutProvider> <Router> <Switch> <RouteWrapper path="/" exact component={() => <HomePage showDiscount={showDiscount}/>} Tutorial: A/B testing with the Evidently sample application 2000 Amazon CloudWatch User Guide layout={CommonLayout} /> <RouteWrapper path="/checkout" component={CheckoutPage} layout={CommonLayout} /> <RouteWrapper path="/auth" component={AuthPage} layout={AuthLayout} /> </Switch> </Router> </CheckoutProvider> </CartProvider> </ProductsProvider> </CommonProvider> </AuthProvider> ) : ( <Spinner animation="border" /> ) ); }; export default App; Each time a user visits the sample app, a custom metric is sent to Evidently for analysis. Evidently analyzes each metric and displays results in real time on the Evidently dashboard. The following example shows a metric payload: [ {"timestamp": 1637368646.468, "type": "aws.evidently.custom", "data": "{\"details \":{\"pageLoadTime\":2058.002058},\"userDetails\":{\"userId\":\"1637368644430\", \"sessionId\":\"1637368644430\"}}" } ] Step 5: Create the project, feature, and experiment Next, you create the project, feature, and experiment in the CloudWatch Evidently console. To create the project, feature, and experiment for this tutorial 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. Tutorial: A/B testing with the Evidently sample application 2001 Amazon CloudWatch User Guide 3. Choose Create project and fill out the fields. You must use EvidentlySampleApp for the project name for the sample to work correctly. For Evaluation event storage, choose Don't store Evaluation events. After filling out the fields, choose Create Project. For more details, see Create a new project. 4. After the project is created, create a feature in that project. Name the feature showDiscount. In this feature, create two variations of the Boolean type. Name the first variation disable with a value of False and name the second variation enable with a value of True. For more information about creating a feature, see Add a feature to a project. 5. After you have finished creating the feature, create an experiment in the project. Name the experiment pageLoadTime. This experiment will use a custom metric called pageLoadTime that measures the page load time of the page being tested. Custom metrics for experiments are created using Amazon EventBridge. For more information about EventBridge, see What Is Amazon EventBridge?. To create that custom metric, do the following when you create the experiment: • Under Metrics, for Metric source, choose Custom metrics. • For Metric name, enter pageLoadTime. • For Goal choose Decrease. This indicates that we want a lower value of this metric to indicate the best variation of the feature. • For Metric rule, enter the following: • For Entity ID, enter UserDetails.userId. • For Value
acw-ug-538
acw-ug.pdf
538
called pageLoadTime that measures the page load time of the page being tested. Custom metrics for experiments are created using Amazon EventBridge. For more information about EventBridge, see What Is Amazon EventBridge?. To create that custom metric, do the following when you create the experiment: • Under Metrics, for Metric source, choose Custom metrics. • For Metric name, enter pageLoadTime. • For Goal choose Decrease. This indicates that we want a lower value of this metric to indicate the best variation of the feature. • For Metric rule, enter the following: • For Entity ID, enter UserDetails.userId. • For Value key, enter details.pageLoadTime. • For Units, enter ms. • Choose Add metric. For Audiences, select 100% so that all users are entered in the experiment. Set up the traffic split between the variations to be 50% each. Then, choose Create experiment to create the experiment. After you create it, it does not start until you tell Evidently to start it. Tutorial: A/B testing with the Evidently sample application 2002 Amazon CloudWatch User Guide Step 6: Start the experiment and test CloudWatch Evidently The final steps are starting the experiment and starting the sample app. To start the tutorial experiment 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the navigation pane, choose Application Signals, Evidently. 3. Choose the EvidentlySampleApp project. 4. Choose the Experiments tab. 5. Choose the button next to pageLoadTime and choose Actions, Start experiment. 6. Choose a time for the experiment to end. 7. Choose Start experiment. The experiment starts immediately. Next, start the Evidently sample app with the following command: npm install -f && npm start Once the app has started, you will be assigned to one of the two feature variations being tested. One variation displays "20% discount" and the other doesn't. Keep refreshing the page to see the different variations. Note Evidently has sticky evaluations. Feature evaluations are deterministic, meaning for the same entityId and feature, a user will always receive the same variation assignment. The only time variation assignments change is when an entity is added to an override or experiment traffic is dialed up. However, to make the use of the sample app tutorial easy for you, Evidently reassigns the sample app feature evaluation every time that you refresh the page, so that you can experience both variations without having to add overrides. Troubleshooting Tutorial: A/B testing with the Evidently sample application 2003 Amazon CloudWatch User Guide We recommend that you use npm version 6.14.14. If you see any errors about building or starting the sample app and you are using a different version of npm, do the following. To install npm version 6.14.14 1. Use a browser to connect to https://nodejs.org/download/release/v14.17.5/. 2. Download node-v14.17.5.pkg and run this pkg to install npm. If you see a webpack not found error, navigate to the evidently-sample-shopping- app folder and try the following: a. Delete package-lock.json b. Delete yarn-lock.json c. Delete node_modules d. Delete the webpack dependency from package.json e. Run the following: npm install -f && npm Tutorial: A/B testing with the Evidently sample application 2004 Amazon CloudWatch User Guide Amazon Q Developer operational investigations (Preview) Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Spain) • Europe (Stockholm) The Amazon Q Developer operational investigations feature is a generative AI-powered assistant that can help you respond to incidents in your system. It uses generative AI to scan your system's telemetry and quickly surface suggestions that might be related to your issue. These suggestions include metrics, logs, deployment events, and root-cause hypotheses. For a complete list of types of data that the AI assistant can surface, see Insights that Amazon Q Developer can surface in investigations For each suggestion, you decide whether to add it to the investigation findings or to discard it. This helps Amazon Q Developer refine and iterate toward the root cause of the issue. Amazon Q Developer can help you find the root cause without having to manually identify and query multiple metrics and other sources of telemetry and events. A troubleshooting issue that would have taken hours of searching and switching between different consoles can be solved in a much shorter time. 2005 Amazon CloudWatch User Guide You can create investigations in three ways: • From within many AWS consoles. For example, you can start an investigation when viewing a CloudWatch metric or alarm in the CloudWatch console, or from a Lambda function's Monitor tab on its properties page. • By asking
acw-ug-539
acw-ug.pdf
539
issue. Amazon Q Developer can help you find the root cause without having to manually identify and query multiple metrics and other sources of telemetry and events. A troubleshooting issue that would have taken hours of searching and switching between different consoles can be solved in a much shorter time. 2005 Amazon CloudWatch User Guide You can create investigations in three ways: • From within many AWS consoles. For example, you can start an investigation when viewing a CloudWatch metric or alarm in the CloudWatch console, or from a Lambda function's Monitor tab on its properties page. • By asking a question in Amazon Q chat. The question could be something like "Why is my Lambda function slow today?" or "What's wrong with my database?" • By configuring a CloudWatch alarm action to automatically start an investigation when the alarm goes into ALARM state. After you start an investigation with any of these methods, Amazon Q Developer scans your system to find telemetry that might be relevant to the situation, and also generates hypotheses based on what it finds. Amazon Q Developer surfaces both the telemetry data and the hypotheses, and enables you to accept or discard each one. Important To help Amazon Q Developer operational investigations (Preview) provide the most relevant information, we might use certain content from Amazon Q, including but not limited to questions that you ask Amazon Q and its response, insights, user interactions, telemetry, and metadata for service improvements. Your trust and privacy, as well as the security of your content, is our highest priority. For more information, see AWS Service Terms and AWS responsible AI policy. You can opt out of having your content collected to develop or improve the quality of Amazon Q Developer operational investigations (Preview) by creating an AI service opt-out policy for either Amazon Q or CloudWatch. For more information, see AI services opt-out policies in the AWS Organizations User Guide. How investigations find data for suggestions Investigations use a wide range of data sources to determine dependency relationships and plan analysis paths, including telemetry data configurations, service configurations, and observed relationships. These dependency relationships are found more easily if you use CloudWatch Application Signals and AWS X-Ray. When Application Signals and X-Ray aren't available, Amazon Q Developer will attempt to infer dependency relationships through co-occurring telemetry anomalies. 2006 Amazon CloudWatch User Guide While Amazon Q Developer will continue to analyze telemetry data and provide suggestions without these features enabled, in order to ensure optimal quality and performance for Amazon Q Developer operational investigations, we strongly recommend that you enable the services and features listed in (Recommended) Best practices to enhance investigations. Costs associated with Amazon Q Developer operational investigations The Amazon Q Developer operational investigations feature is provided at no additional cost while in Preview release. During investigations, Amazon Q Developer might incur AWS service usage including telemetry and resource queries and other API usage. While the majority of these will not be charged to your AWS bill, there are exceptions including but not limited to CloudWatch APIs (ListMetrics, GetDashboard, ListDashboards, and GetInsightRuleReport), X-Ray APIs (GetServiceGraph, GetTraceSummaries, and BatchGetTraces). Amazon Q Developer also uses AWS Cloud Control APIs which might incur usage of AWS services such as Amazon Kinesis Data Streams and AWS Lambda. Additionally, integration with Amazon Q Developer in chat applications which might incur usage of Amazon Simple Notification Service. For usage of these services exceeding the AWS Free Tier, you will see charges on your AWS bill. These charges are expected to be minimal for normal usage of Amazon Q Developer operational investigations. For more information, see Amazon Kinesis Data Streams pricing, AWS Lambda pricing for Automation, and Amazon Simple Notification Service pricing. Topics • AWS services where investigations are supported • Getting started • Investigate operational issues in your environment • Manage your current investigations • Security in operational investigations • Troubleshooting • Integrations with other systems • (Recommended) Best practices to enhance investigations • Operational investigation data retention • Insights that Amazon Q Developer can surface in investigations 2007 Amazon CloudWatch User Guide AWS services where investigations are supported Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Spain) • Europe (Stockholm) You can launch investigations from telemetry data (such as CloudWatch metrics, alarms, and logs), review generated anomaly signals, and explore hypotheses on investigations. Amazon Q Developer operational investigations work best when helping you with automated troubleshooting guidance on the AWS services listed below: •
acw-ug-540
acw-ug.pdf
540
to change. It is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Spain) • Europe (Stockholm) You can launch investigations from telemetry data (such as CloudWatch metrics, alarms, and logs), review generated anomaly signals, and explore hypotheses on investigations. Amazon Q Developer operational investigations work best when helping you with automated troubleshooting guidance on the AWS services listed below: • Amazon EC21 • Amazon ECS on Amazon EC22 • Amazon ECS on Fargate2 • Amazon EKS2 • Amazon DynamoDB • Amazon S3 • Amazon EBS1 AWS services where investigations are supported 2008 Amazon CloudWatch • Lambda • Amazon Kinesis Data Streams • Amazon Data Firehose • Amazon API Gateway • Amazon SQS • Amazon SNS User Guide The list of services will continue to be expanded over time. Amazon Q Developer operational investigations utilizes a wide range of data sources to determine dependency relationships and plan analysis paths, including telemetry data configurations, service configurations, and observed relationships through CloudWatch Application Signals and X-Ray. Where none of the above is available, Amazon Q Developer operational investigations will attempt to infer dependency relationships through co-occurring telemetry anomalies. Best practice setup While Amazon Q Developer operational investigations will continue to analyze telemetry data and provide suggestions without the following features enabled, in order to ensure optimal quality and performance for Amazon Q Developer operational investigations, we highly recommend to complete the following steps: • 1For both Amazon EC2 and Amazon EBS, update your CloudWatch agent to version 1.30049.1 or later. For more information, see Collect metrics, logs, and traces with the CloudWatch agent. • 2For both Amazon ECS and Amazon EKS, enable CloudWatch Container Insights. For more information, see Container Insights. • We recommend that you enable CloudWatch Application Signals and X-Ray. For more information, see Application Signals and What is AWS X-Ray. Getting started Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: • US East (N. Virginia) Getting started 2009 Amazon CloudWatch User Guide • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Spain) • Europe (Stockholm) To set up Amazon Q Developer operational investigations, you create an investigation group. You can also see a sample investigation to get an overall idea of how they work. Topics • See a sample investigation • Set up operational investigations See a sample investigation If you'd like to see the Amazon Q Developer operational investigations feature in action before you configure it for your account, you can walk through a sample investigation. The sample investigation doesn't use your data and doesn't make data calls or start API operations in your account. To view the sample investigation 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the left navigation pane, choose AI Operations, Overview. 3. Choose Try a sample investigation. The console displays the sample investigation, with suggestions and findings in the right pane. In each popup, choose Next to advance to the next part of the sample walkthrough. See a sample investigation 2010 Amazon CloudWatch User Guide Set up operational investigations To set up Amazon Q Developer operational investigations in your account, you create an investigation group. Creating an investigation group is a one-time setup task. Settings in the investigation group help you centrally manage the common properties of your investigations, such as the following: • Who can access the investigations • Whether investigation data is encrypted with a customer managed AWS Key Management Service key. • How long investigations and their data are retained by default. Currently, you can have one investigation group per account. Each investigation in your account will be part of this investigation group. To create an investigation group and set up Amazon Q Developer operational investigations, you must be signed in to an IAM principal that has the either the AIOpsConsoleAdminPolicy or the AdministratorAccess IAM policy attached, or to an account that has similar permissions. Note To be able to choose the recommended option of creating a new IAM role for Amazon Q Developer operational investigations, you must be signed in to an IAM principal that has the iam:CreateRole, iam:AttachRolePolicy, and iam:PutRolePolicy permissions. Important Amazon Q Developer operational investigations uses cross-Region inference to distribute traffic across different AWS Regions. For more information, see Cross-Region inference. To create an investigation group and enable Amazon Q Developer operational investigations in your account 1. Open the CloudWatch console
acw-ug-541
acw-ug.pdf
541
that has the either the AIOpsConsoleAdminPolicy or the AdministratorAccess IAM policy attached, or to an account that has similar permissions. Note To be able to choose the recommended option of creating a new IAM role for Amazon Q Developer operational investigations, you must be signed in to an IAM principal that has the iam:CreateRole, iam:AttachRolePolicy, and iam:PutRolePolicy permissions. Important Amazon Q Developer operational investigations uses cross-Region inference to distribute traffic across different AWS Regions. For more information, see Cross-Region inference. To create an investigation group and enable Amazon Q Developer operational investigations in your account 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the left navigation pane, choose AI Operations, Investigations. Set up operational investigations 2011 Amazon CloudWatch User Guide 3. Choose Configure for this account. 4. Enter a name for the investigation group. 5. Optionally change the retention period for investigations. For more information about what the retention period governs, see Operational investigation data retention. 6. (Optional) To encrypt your investigation data with a customer managed AWS KMS key, choose Customize encryption settings and follow the steps to create or specify a key to use. If you don't specify a customer managed key, Amazon Q Developer operational investigations uses an AWS owned key for encryption. For more information, see Encryption of investigation data. 7. If you haven't already done so, use the IAM console to provision access for your users to be able to see and manage investigations. We provide IAM roles for administrators, operators, and viewers. For more information, see User permissions. 8. (Optional) In the US East (N. Virginia) Region, you can have investigations attribute investigation actions such as adding a suggestion to the Feed to individual users. You do this by integrating Amazon Q Developer operational investigations with IAM Identity Center. To do so, validate that you meet the pre-requisites and then choose to allow the creation of a managed IAM Identity Center application for Amazon Q Developer operational investigations. For more information about the pre-requisites, see AWS IAM Identity Center. 9. For Amazon Q Developer permissions, choose one of the following. For more information about these options, see How to control what data Amazon Q Developer has access to during investigations. To be able to choose either of the first two options, you must be signed in to an IAM principal that has the iam:CreateRole, iam:AttachRolePolicy, and iam:PutRolePolicy permissions. • The recommended option is to choose Auto-create a new role with default investigation permissions. If you choose this option, the assistant is granted the AIOpsAssistantPolicy IAM policy. For more information about the contents of this policy, see IAM policy for Amazon Q Developer operational investigations (AIOpsAssistantPolicy). • Choose Create a new role from AWS policy templates to customize the permissions that Amazon Q Developer will have during investigations. If you choose this option, you must be sure to scope down the policy to only the permissions that you want Amazon Q Developer to have during investigations. • Choose Assign an existing role if you already have a role with the permissions that you want to use. Set up operational investigations 2012 Amazon CloudWatch User Guide If you choose this option, you must make sure the role includes a trust policy that names aiops.amazonaws.com as the service principal. For more information about using service principals in trust policies, see AWS service principals We also recommend that you include a Condition section with the account number, to prevent a confused deputy situation. The following example trust policy illustrates both the service principal and the Condition section. { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "aiops.amazonaws.com" }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "aws:SourceAccount": "123456789012" }, "ArnLike": { "aws:SourceArn": "arn:aws:aiops:us-east-1:123456789012:*" } } } ] } 10. (Optional) For Enhanced integrations, choose to allow Amazon Q Developer access to additional services in your system, to enable it to gather more data and be more useful. a. In the Tags for application boundary detection section, enter the existing custom tag keys for custom applications in your system. Resource tags help Amazon Q Developer narrow the search space when it is unable to discover definite relationships between resources. For example, to discover that an Amazon ECS service depends on an Amazon RDS database, Amazon Q Developer can discover this relationship using data sources such as X-Ray and CloudWatch Application Signals. However, if you haven't deployed these features, Amazon Q Developer will attempt to identify possible relationships. Tag Set up operational investigations 2013 Amazon CloudWatch User Guide boundaries can be used to narrow the resources that will be discovered by Amazon Q Developer in these cases. You don't need to enter tags created by myApplications or AWS CloudFormation, because Amazon Q Developer can automatically detect those tags. b. CloudTrail records events about changes in your system including deployment
acw-ug-542
acw-ug.pdf
542
depends on an Amazon RDS database, Amazon Q Developer can discover this relationship using data sources such as X-Ray and CloudWatch Application Signals. However, if you haven't deployed these features, Amazon Q Developer will attempt to identify possible relationships. Tag Set up operational investigations 2013 Amazon CloudWatch User Guide boundaries can be used to narrow the resources that will be discovered by Amazon Q Developer in these cases. You don't need to enter tags created by myApplications or AWS CloudFormation, because Amazon Q Developer can automatically detect those tags. b. CloudTrail records events about changes in your system including deployment events. These events can often be useful to Amazon Q Developer to create hypotheses about root causes of issues in your system. In the CloudTrail for change event detection section, you can do one or both of the following. • Give Amazon Q Developer some access to the events logged by AWS CloudTrail by enabling Allow the assistant access to CloudTrail change events through the CloudTrail Event history. For more information, see Working with CloudTrail Event history. • Give Amazon Q Developer access to additional CloudTrail data by entering one or more CloudTrail trails, which are records of activities within your AWS account. This is supported only for trails that are sent to log groups in CloudWatch Logs. For more information about trails see Working with CloudTrail trails. c. The X-Ray for topology mapping and Application Signals for health assessment sections point out other AWS services that can help Amazon Q Developer find information. If you have deployed them and you have granted the AIOpsAssistantPolicy IAM policy to Amazon Q Developer, it will be able to access X-Ray and Application Signals telemetry. For more information about how these services help Amazon Q Developer, see X-Ray and CloudWatch Application Signals 11. (Optional) If you are in the US East (N. Virginia) Region, you can integrate Amazon Q Developer operational investigations with a third-party ticketing system. Integrating with a ticketing tool enables Amazon Q Developer to send information about an investigation to that ticketing tool. This feature is available only in US East (N. Virginia). Important When you create an integration with a third-party ticketing system, the system creates a secret in AWS Secrets Manager. This secret contains your basic authentication credentials for the third-party tool and is used to connect your AWS account to Set up operational investigations 2014 Amazon CloudWatch User Guide that tool. If you delete the integration, the secret that contains your authentication credentials is also deleted. To integrate Amazon Q Developer operational investigations with a third-party ticketing tool, do the following in the Third-party integrations area: a. b. Choose Add integration. In the Add integration dialog box, do the following: i. ii. For Name, enter a name to identify this integration in your investigations. For Instance type, choose from the available third-party tools, such as Jira or ServiceNow. Note Integration with Jira is supported only for Jira Cloud. iii. Provide the additional information required to integrate with your selected tool: Jira • Username – A valid email address with access to the project being onboarded. • Password – Your API token value from Atlassian. For more information, see Manage API tokens for your Atlassian account on the Atlassian website. • Jira site name – The application name for your Jira project. This is typically the first component of the URL for your project in Atlassian. For example, in the URL https://AnyCompany.atlassian.net, the application name is AnyCompany. If you are uncertain, contact your Jira project manager to verify this information. • Project key – The project key for your Jira project. To retrieve this project key, sign in to your Jira project, choose Administration, Project, View all projects, and then copy the Key value from the appropriate project. Set up operational investigations 2015 Amazon CloudWatch User Guide Important Ensure that your Jira account and email address both have access to the project. If you are uncertain, contact your Jira project manager to verify this information. ServiceNow • Username – Your ServiceNow username. • Password – Your ServiceNow instance password. • Instance ID – Your ServiceNow instance ID. You can view this information by signing in to your ServiceNow account. If you are uncertain, contact your ServiceNow administrator to verify this information. c. Choose Connect. Important After you have completed this configuration procedure, we recommend that you create a test investigation and try out the integration before using it in an active investigation. 12. (Optional) You can integrate Amazon Q Developer operational investigations with a chat channel using Amazon Q Developer in chat applications. This makes it possible to receive notifications about an investigation through the chat channel. Amazon Q Developer operational investigations and Amazon Q Developer in chat applications support chat channels in the following applications: • Slack
acw-ug-543
acw-ug.pdf
543
account. If you are uncertain, contact your ServiceNow administrator to verify this information. c. Choose Connect. Important After you have completed this configuration procedure, we recommend that you create a test investigation and try out the integration before using it in an active investigation. 12. (Optional) You can integrate Amazon Q Developer operational investigations with a chat channel using Amazon Q Developer in chat applications. This makes it possible to receive notifications about an investigation through the chat channel. Amazon Q Developer operational investigations and Amazon Q Developer in chat applications support chat channels in the following applications: • Slack • Microsoft Teams Set up operational investigations 2016 Amazon CloudWatch User Guide If you want to integrate with a chat channel, we recommend that you complete some other steps before performing this step in the create an investigation group process. For more information, see Integration with third-party chat systems. To then perform the steps here to integrate with a chat channel in Amazon Q Developer in chat applications, do the following: a. b. In the Chat client integration section, choose Select SNS topic. Select the SNS topic to use for sending notifications about your investigations. 13. Choose Complete setup. Investigate operational issues in your environment Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Spain) • Europe (Stockholm) Contents Investigate operational issues in your environment 2017 Amazon CloudWatch • Create an investigation • Create an investigation from an AWS console page • Create an investigation from Amazon Q chat • Create an investigation from a CloudWatch alarm action • View and continue an open investigation User Guide • Reviewing and executing suggested runbook remediations for Amazon Q Developer operational investigations Create an investigation Create an investigation from an AWS console page You can start an investigation from several AWS consoles, including (but not limited to) CloudWatch alarm pages, CloudWatch metric pages, and Lambda monitoring pages. To start an investigation from an AWS console page 1. In the graph of the metric or alarm that you want to investigate, select the time range that you want the investigation to include. 2. If the top of the page has an Investigate button, choose it and then choose Start new investigation. Otherwise, choose the vertical ellipsis menu icon for the metric, and choose Investigate, Start a new investigation. 3. In the Investigation pane, enter a name for the investigation in New investigation title, and optionally enter notes about the selected metric or alarm. Then choose Start investigation. The investigation starts. Amazon Q Developer scans your telemetry data to find data that might be associated with this situation. To move the investigation data to the larger pane, choose Open in full page. For detailed instructions about steps that you can take while continuing the investigation, see View and continue an open investigation. 4. 5. Create an investigation 2018 Amazon CloudWatch User Guide Create an investigation from Amazon Q chat You can ask questions about issues in your deployment in Amazon Q Developer chat. The question could be something like "Why is my Lambda function slow today?" When you do so, Amazon Q Developer might ask follow up questions and run a health check regarding the issue. After the health check, the chat will prompt you about whether you want to start an investigation. For more information and more sample questions, see Chatting with Amazon Q Developer about AWS.. For detailed instructions about steps that you can take while continuing the investigation after it has been started, see View and continue an open investigation. Create an investigation from a CloudWatch alarm action When you create a CloudWatch alarm, you can specify for it to automatically start an investigation when it goes into ALARM state. You can do this for both metric alarms and composite alarms. For more information about creating alarms, see Alarming on metrics and Create a composite alarm. View and continue an open investigation Use the steps in this section to view and continue and existing investigation To view and continue an investigation 1. If you aren't already on the page for the investigation, do the following: a. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. b. c. In the left navigation pane, choose AI Operations, Investigations. Choose the name of the investigation. Tip If your investigation is in US East (N. Virginia) and you have integrated Amazon Q Developer operational investigations with ServiceNow or Jira, you can associate the investigation with the integrated tool from the
acw-ug-544
acw-ug.pdf
544
a composite alarm. View and continue an open investigation Use the steps in this section to view and continue and existing investigation To view and continue an investigation 1. If you aren't already on the page for the investigation, do the following: a. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. b. c. In the left navigation pane, choose AI Operations, Investigations. Choose the name of the investigation. Tip If your investigation is in US East (N. Virginia) and you have integrated Amazon Q Developer operational investigations with ServiceNow or Jira, you can associate the investigation with the integrated tool from the investigations heading. For example, for Jira integrations, hover over Jira Cloud in the investigation header, and then choose from Add existing ticket, Create new ticket, or Edit integration. View and continue an open investigation 2019 Amazon CloudWatch User Guide If no integration has been set up yet, you can configure one. For information, see step 3 in Set up operational investigations. 2. The Feed section displays the items that have been added to the investigation findings, including the metric or alarm that was originally selected to start the investigation with. The pane on the right includes tabs. Choose the Suggestions tab. 3. The Suggestions tab displays observations of other telemetry that Amazon Q Developer has found that might be related to the investigation. It might also include hypotheses, which are possible reasons or root causes that Amazon Q Developer has found for the situation. Both observations and hypotheses are written in natural language by Amazon Q Developer. You have several options: • For each suggestion, you can choose Accept or Discard. When you choose Accept, the suggestion is added to the Feed section, and Amazon Q Developer uses this information to direct further scanning and suggestions. • • If you choose Discard, the suggestion is moved to the Discarded tab. For each observation-type suggestion, you can choose to expand the graph in the Suggestions tab, or open it in the CloudWatch console to see more details about it. Some of the observations might be results of CloudWatch Logs Insights queries that Amazon Q Developer ran as part of the investigation. When an observation is a CloudWatch Logs Insights query result, the query itself is displayed as part of the observation. You can edit the query and re-run it. To do so, choose the vertical ellipsis menu icon by the results, and then choose Open in Logs Insights. For more information, see Analyzing log data with CloudWatch Logs Insights. • If you know of telemetry in an AWS service that might apply to this investigation, you can go to that service's console and add the telemetry to the investigation. For example, to add a Lambda metric to the investigation, you can do the following: 1. Open the Lambda console. 2. In the Monitor section, find the metric. View and continue an open investigation 2020 Amazon CloudWatch User Guide 3. Open the vertical ellipsis context menu for the metric, choose Investigate, Add to investigation Then, in the Investigate pane, select the name of the investigation. • When you view a hypothesis in the Suggestions tab, you can choose Show reasoning to display the data that Amazon Q Developer used to generate the hypothesis. • If your investigation is in the US East (N. Virginia) Region and you have integrated Amazon Q Developer operational investigations with a third-party ticketing system, you can attach this investigation to a ticket in that system. To do so, hover on No ticket attached above the Feed, and then choose either Attach ticket or Create ticket. • • You can choose the Discarded tab and view the suggestions that have been previously discarded. To add one of them to the findings, choose Restore to findings. To add notes to the findings, choose New note in the Feed pane. Then enter your notes and choose Add. 4. When you add a hypothesis to the Feed area, it might display Show suggested actions. If so, choosing this displays possible actions that you can take, assuming that hypothesis is correct about the issue. Possible actions include the following: • Documentation suggestions are links to AWS documentation that can help you understand the issue that you are working on, and how to solve it. To view suggested documentation, choose its Review link • Runbook suggestions are suggestions that leverage the pre-defined runbooks in Systems Manager Automation. Each runbook defines a number of steps for performing a task on an AWS resource. Important There is a charge for executing an Automation runbook. However, Amazon Q Developer operational investigations provides you with a preview of actions that a suggested runbook takes, giving you an opportunity to better evaluate whether to execute the runbook. For information about Automation pricing, see AWS Systems Manager pricing for
acw-ug-545
acw-ug.pdf
545
the issue that you are working on, and how to solve it. To view suggested documentation, choose its Review link • Runbook suggestions are suggestions that leverage the pre-defined runbooks in Systems Manager Automation. Each runbook defines a number of steps for performing a task on an AWS resource. Important There is a charge for executing an Automation runbook. However, Amazon Q Developer operational investigations provides you with a preview of actions that a suggested runbook takes, giving you an opportunity to better evaluate whether to execute the runbook. For information about Automation pricing, see AWS Systems Manager pricing for Automation. View and continue an open investigation 2021 Amazon CloudWatch User Guide For information about continuing with a runbook action, see Reviewing and executing suggested runbook remediations for Amazon Q Developer operational investigations before continuing with the following step in this procedure. 5. To end an investigation, choose End investigation and then optionally add final notes. Then choose Save. The investigation status changes to Archived. You can restart archived investigations by opening the investigation page and choosing Restart investigation. We recommend that you don't leave investigations open indefinitely, because alarm state transitions related to the investigation will keep being added to the investigation as long as it is open. Note At some points, you might see Completed the analysis. Finished with the investigation. displayed above the Feed area. If you then add more telemetry to the findings, this message changes and Amazon Q Developer begins scanning your telemetry again, based on the new data that you added to the findings. Reviewing and executing suggested runbook remediations for Amazon Q Developer operational investigations When you add a hypothesis to the Feed area of an active investigation, Amazon Q Developer operational investigations might display Show suggested actions. One suggested action might be to view documentation with information to help you remediate a problem manually. Another suggestion might be to use an Automation runbook to attempt to automatically resolve the issue. Automation is a capability in Systems Manager, another AWS service. Automation runbooks define a series of steps, or actions, to be run on the resources that you select. Each runbook is designed to address a specific issue. Runbooks can address a variety of operational needs: Creating, repairing, reconfiguring, installing, troubleshooting, remediating, duplicating, and more. For more information about Automation, see Integration with AWS Systems Manager Automation. Reviewing and executing suggested runbook remediations 2022 Amazon CloudWatch Before you begin User Guide Before working with Automation runbooks in an investigation, be aware of the following important considerations: • Choosing to execute a runbook incurs charges. For information, see AWS Systems Manager pricing. • Root causes and runbook suggestions are powered by automated reasoning and generative artificial intelligence services. Important You are responsible for actions that result from executing runbook steps and the choice of parameter values entered during runbook execution. You might need to edit the suggested runbook to make sure the runbook performs as expected. For more information, see AWS responsible AI policy. • Depending on the runbook, you might need to enter values for the runbook's Input parameters before the execution can run. • The runbook executes using the IAM permissions assigned to the operator. If necessary, sign in with different IAM permissions to execute the runbook. In addition to permissions for the actions being taken, you'll need additional Systems Manager permissions to execute runbook steps. For more information, see Setting up Automation in the AWS Systems Manager User Guide. To review and execute suggested runbook actions for Amazon Q Developer operational investigations 1. To view information about a suggested runbook, choose Review for information about how to execute the runbook steps. On the investigation details page, choose Suggestions. 2. In the Suggestions pane, review the list of hypotheses based on the system's analysis of the issue under investigation. For each hypothesis, you can choose from the following options: • Show reasoning – View more information about why the system has generated the hypothesis. Reviewing and executing suggested runbook remediations 2023 Amazon CloudWatch User Guide • View actions – View the suggested actions for the issue. Not all hypotheses will include suggested actions. • Accept – Accept the hypothesis and add it to the investigation's Feed section. Note Accepting the hypothesis doesn't automatically run the associated runbook solution. You can view suggested runbooks before accepting a hypothesis, but you must accept the hypothesisto execute a runbook. • Discard – Reject the hypothesis and don't engage with it any further. 3. After you choose View action, in the Suggested actions pane, review the list of suggested actions you can take to address the issue. Suggested actions can include one or more of the following: • AWS knowledge articles – Provides information about steps you can take to manually address the issue, plus a
acw-ug-546
acw-ug.pdf
546
to the investigation's Feed section. Note Accepting the hypothesis doesn't automatically run the associated runbook solution. You can view suggested runbooks before accepting a hypothesis, but you must accept the hypothesisto execute a runbook. • Discard – Reject the hypothesis and don't engage with it any further. 3. After you choose View action, in the Suggested actions pane, review the list of suggested actions you can take to address the issue. Suggested actions can include one or more of the following: • AWS knowledge articles – Provides information about steps you can take to manually address the issue, plus a link to more information. • AWS documentation – Provides links to user documentation topics related to the issue. • AWS-owned runbooks – Lists one or more Automation runbooks that are managed by AWS that you can run to attempt issue resolution. • Runbooks owned by you – Lists one or more custom Automation runbooks created by you or someone else in your account or organization, which you can run to attempt issue resolution. Note The system automatically generates this list of runbooks by evaluating keywords in your custom runbooks and then comparing them to terms related to the issue being investigated. More keyword matches mean a particular custom runbook appears higher in the Runbooks owned by you list. 4. After reviewing the hypothesis, you can examine a specific suggested action further and read related documentation by choosing Learn more. You can also choose Review details to inspect suggested runbooks owned by AWS and you. 5. When choosing Review details for runbooks, do the following: Reviewing and executing suggested runbook remediations 2024 Amazon CloudWatch User Guide a. b. c. For Runbook description, review the content, which provides an overview of the actions the runbook can take to remediate the issue being investigated. Choose View steps to visualize the runbook's workflow and drill into the details of individual steps. For Input parameters, specify values for any parameters required by the runbook. These parameters vary from runbook to runbook. For Execution preview, carefully review the information. This information explains what the scope and impact would be if you choose to execute the runbook. The Execution preview content provides the following information: • How many accounts and Regions the runbook operation would occur in. • The types of actions that would be taken, and how many of each type. Action types include the following: • Mutating: A runbook step would make changes to the targets through actions that create, modify, or delete resources. • Non-Mutating: A runbook step would retrieve data about resources but not make changes to them. This category generally includes Describe, List, Get, and similar read-only API actions. • Undetermined: An undetermined step invokes executions performed by another orchestration service like AWS Lambda, AWS Step Functions, or Run Command, a capability of AWS Systems Manager. An undetermined step might also call a third- party API or run a Python or PowerShell script. Systems Manager Automation can't detect what the outcome would be of the orchestration processes or third-party API executions, and therefore can't evaluate them. The results of those steps would have to be manually reviewed to determine their impact. For information about supported actions and their impact types, see Remediation impact types of runbook actions in the AWS Systems Manager User Guide. d. Review the preview information carefully before deciding whether to proceed. At this point, you can choose one of the following actions: • Stop and do not execute the runbook. • Change the input parameters before executing the runbook. • Execute the runbook with the options you have already selected. Reviewing and executing suggested runbook remediations 2025 Amazon CloudWatch User Guide Important Choosing to execute the runbook incurs charges. For information, see AWS Systems Manager pricing. 6. If you want to execute the runbook, choose Execute. If you already accepted the hypothesis, the execution runs. If you have not already accepted the hypothesis, a dialog box prompts you to accept it before the execution runs. After you choose Execute for a runbook, that action is added to the Feed pane of the investigation. From the investigation, you can monitor new data in the metrics in the findings to see if the runbook actions are correcting the issue. Manage your current investigations Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Spain) Manage your current investigations 2026 Amazon CloudWatch • Europe (Stockholm) User Guide You can view a list of your
acw-ug-547
acw-ug.pdf
547
see if the runbook actions are correcting the issue. Manage your current investigations Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Spain) Manage your current investigations 2026 Amazon CloudWatch • Europe (Stockholm) User Guide You can view a list of your current investigations, end active investigations, re-open archived investigations, rename, and delete investigations. You can take these actions on individual investigations, or in bulk. To manage your current investigations 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. 3. 4. In the left navigation pane, choose AI Operations, Investigations. (Optional) Filter the investigations displayed in the list by name or investigation state. Select the checkboxes for the investigation or investigations that you want to take action on. 5. Choose End investigation, Rename, or Delete. You will be prompted to confirm your action or to input a new investigation title. Restart an archived investigation You can restart archived investigations. To restart an archived investigation 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. In the left navigation pane, choose AI Operations, Investigations. 3. Choose the name of an archived investigation. 4. Choose Restart investigation. 5. For instructions for working in an existing investigation, see View and continue an open investigation. Security in operational investigations Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: Restart an archived investigation 2027 Amazon CloudWatch User Guide • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Spain) • Europe (Stockholm) This section includes topics about how Amazon Q Developer operational investigations integrate with AWS security and permissions features. Topics • User permissions • How to control what data Amazon Q Developer has access to during investigations • Encryption of investigation data • Cross-Region inference User permissions AWS has created three managed IAM policies that you can use for your users who will be working with Amazon Q Developer operational investigations. • AIOpsConsoleAdminPolicy– grants an administrator the ability to set up Amazon Q Developer operational investigations in the account, access to Amazon Q Developer operational investigations actions, the management of trusted identity propagation, and the management of integration with IAM Identity Center and organizational access. User permissions 2028 Amazon CloudWatch User Guide • AIOpsOperatorAccess– grants a user access to investigation actions including starting an investigation. It also grants additional permissions that are necessary for accessing investigation events. • AIOpsReadOnlyAccess– grants read-only permissions for Amazon Q Developer operational investigations and other related services. We recommend that you use three IAM principals, granting one of them the AIOpsConsoleAdminPolicy IAM policy, granting another the AIOpsOperatorAccess policy, and granting the third the AIOpsReadOnlyAccess policy. These principals could be either IAM roles (recommended) or IAM users. Then your users who work with Amazon Q Developer operational investigations would sign on with one of these principals. How to control what data Amazon Q Developer has access to during investigations When you enable the Amazon Q Developer operational investigations feature, you specify what permissions that Amazon Q Developer has to access your resources during investigations. You do this by assigning an IAM role to the assistant. To enable Amazon Q Developer to access resources and be able to make suggestions and hypotheses, the recommended method is to attach the AIOpsAssistantPolicy to the assistant's role. This grants the assistant permissions to analyze your AWS resources during your investigations. For information about the complete contents of this policy, see IAM policy for Amazon Q Developer operational investigations (AIOpsAssistantPolicy). You can also choose to attach the general AWS ReadOnlyAccess to the assistant's role, in addition to attaching AIOpsAssistantPolicy. The reason to do this is that AWS updates ReadOnlyAccess more frequently with permissions for new AWS services and actions that are released. The AIOpsAssistantPolicy will also be updated for new actions, but not as frequently. If you want to scope down the permissions granted to Amazon Q Developer, you can attach a custom IAM policy to the assistant's IAM role instead of attaching the AIOpsAssistantPolicy policy. To do this, start your custom policy with the contents of AIOpsAssistantPolicy and then remove permissions that you don't want to grant to Amazon Q Developer. This will prevent the assistant from being able to make suggestions based on the AWS services or actions that you
acw-ug-548
acw-ug.pdf
548
permissions for new AWS services and actions that are released. The AIOpsAssistantPolicy will also be updated for new actions, but not as frequently. If you want to scope down the permissions granted to Amazon Q Developer, you can attach a custom IAM policy to the assistant's IAM role instead of attaching the AIOpsAssistantPolicy policy. To do this, start your custom policy with the contents of AIOpsAssistantPolicy and then remove permissions that you don't want to grant to Amazon Q Developer. This will prevent the assistant from being able to make suggestions based on the AWS services or actions that you don't grant access to. How to control what data Amazon Q Developer has access to during investigations 2029 Amazon CloudWatch Note User Guide Anything that Amazon Q Developer can access can be added to the investigation and seen by your investigation operators. We recommend that you align Amazon Q Developer operational investigations permissions with the permissions that your investigation group operators have. Allowing Amazon Q Developer to decrypt encrypted data during investigations If you encrypt your data in any of the following services with a customer managed key in AWS KMS, and you want Amazon Q Developer to be able to decrypt the data from these services and include them in investigations, you'll need to attach one or more additional IAM policies to the assistant's IAM role. • AWS Step Functions The policy statement should include a context key for encryption context to help scope down the permissions. For example, the following policy would enable the Amazon Q Developer to decrypt data for a Step Functions state machine. { "Version": "2012-10-17", "Statement": [ { "Sid": "AIOPSKMSAccessForStepFunctions", "Effect": "Allow", "Principal": { "Service": "aiops.amazonaws.com" }, "Action": [ "kms:Decrypt" ], "Resource": "*", "Condition": { "StringEquals": { "kms:ViaService": "states.*.amazonaws.com", How to control what data Amazon Q Developer has access to during investigations 2030 Amazon CloudWatch User Guide "kms:EncryptionContext:aws:states:stateMachineArn": "arn:aws:states:region:accountId:stateMachine:*" } } } ] } For more information about these types of policies and using these context keys, see kms:ViaService and kms:EncryptionContext:context-key in the AWS Key Management Service Developer Guide, and aws:SourceArn in the IAM User Guide. Encryption of investigation data For the encryption of your investigation data, AWS offers two options: • AWS owned keys– By default, Amazon Q Developer encrypts investigation data at rest with an AWS owned key. You can't view or manage AWS owned keys, and you can't use them for other purposes or audit their use. However, you don't have to take any action or change any settings to use these keys. For more information about AWS owned keys, see AWS owned keys. • Customer managed keys– These are keys that you create and manage yourself. You can choose to use a customer managed key instead of an AWS owned key for your investigation data. For more information about customer managed keys, see Customer managed keys. Note Amazon Q Developer automatically enables encryption at rest using AWS owned keys at no charge. If you use a customer managed key, AWS KMS charges apply. For more information about pricing, see AWS Key Management Service pricing. For more information about AWS KMS, see AWS Key Management Service. Using a customer managed key for your investigation group You can associate an investigation group with a customer managed key, and then all investigations created in that group will use the customer managed key to encrypt your investigation data at rest. Encryption of investigation data 2031 Amazon CloudWatch User Guide Amazon Q Developer operational investigations customer managed key usage has the following conditions: • Amazon Q Developer operational investigations supports only symmetric encryption AWS KMS keys with the default key spec, SYMMETRIC_DEFAULT, and that have usage defined as ENCRYPT_DECRYPT. • For a user to create or update an investigation group with a customer managed key, that user must have the kms:DescribeKey, kms:GenerateDataKey, and kms:Decrypt permissions. • For a user to create or update an investigation in an investigation group that uses a customer managed key, that user must have the kms:GenerateDataKey and kms:Decrypt permissions. • For a user to view investigation data in an investigation group that uses a customer managed key, that user must have the kms:Decrypt permission. Setting up investigations to use a AWS KMS customer managed key First, if you don't already have a symmetric key that you want to use, create a new key with the following command. aws kms create-key The command output includes the key ID and the Amazon Resource Name (ARN) of the key. You will need those in later steps in this section. The following is an example of this output. { "KeyMetadata": { "Origin": "AWS_KMS", "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "Description": "", "KeyManager": "CUSTOMER", "Enabled": true, "CustomerMasterKeySpec": "SYMMETRIC_DEFAULT", "KeyUsage": "ENCRYPT_DECRYPT", "KeyState": "Enabled", "CreationDate": 1478910250.94, "Arn": "arn:aws:kms:us-west-2:111122223333:key/6f815f63-e628-448c-8251- e4EXAMPLE", "AWSAccountId": "111122223333", "EncryptionAlgorithms": [ "SYMMETRIC_DEFAULT" Encryption of investigation data 2032 Amazon CloudWatch
acw-ug-549
acw-ug.pdf
549
AWS KMS customer managed key First, if you don't already have a symmetric key that you want to use, create a new key with the following command. aws kms create-key The command output includes the key ID and the Amazon Resource Name (ARN) of the key. You will need those in later steps in this section. The following is an example of this output. { "KeyMetadata": { "Origin": "AWS_KMS", "KeyId": "1234abcd-12ab-34cd-56ef-1234567890ab", "Description": "", "KeyManager": "CUSTOMER", "Enabled": true, "CustomerMasterKeySpec": "SYMMETRIC_DEFAULT", "KeyUsage": "ENCRYPT_DECRYPT", "KeyState": "Enabled", "CreationDate": 1478910250.94, "Arn": "arn:aws:kms:us-west-2:111122223333:key/6f815f63-e628-448c-8251- e4EXAMPLE", "AWSAccountId": "111122223333", "EncryptionAlgorithms": [ "SYMMETRIC_DEFAULT" Encryption of investigation data 2032 Amazon CloudWatch ] } } Set permissions on the key User Guide Next, set permissions on the key. By default, all AWS KMS keys are private. Only the resource owner can use it to encrypt and decrypt data. However, the resource owner can grant permissions to access the key to other users and resources. With this step, you give the AI Operations service principal permission to use the key. This service principal must be in the same AWS Region where the KMS key is stored. As a best practice, we recommend that you restrict the use of the KMS key to only those AWS accounts or resources that you specify. The first step to set the permissions is to save the default policy for your key as policy.json. Use the following command to do so. Replace key-id with the ID of your key. aws kms get-key-policy --key-id key-id --policy-name default --output text > ./ policy.json Open the policy.json file in a text editor and add the following policy sections into that policy. Separate the existing statement from the new sections with a comma. These new sections use Condition sections to enhance the security of the AWS KMS key. For more information, see AWS KMS keys and encryption context. This policy provides permissions for service principals for the following reasons: • The aiops service needs GenerateDataKey permissions to get the data key and use that data key to encrypt your data while it is stored in rest. The Decrypt permission is needed to decrypt your data while reading from the data store. The decryption happens when you read the data using aiops APIs or when you update the investigation or investigation event. The update operation fetches the existing data after decrypting it, updates the data, and stores the updated data in the data store after encrypting • The CloudWatch alarms service can create investigations or investigation events. These create operations verify that the caller has access to the AWS KMS key defined for the investigation group. The policy statement gives the GenerateDataKey and Decrypt permissions to the CloudWatch alarms service to create investigations on behalf of you. Encryption of investigation data 2033 Amazon CloudWatch Note User Guide The following policy assumes that you follow the recommendation of using three IAM principals, and granting one of them the AIOpsConsoleAdminPolicy IAM policy, granting another the AIOpsOperatorAccess policy, and granting the third the AIOpsReadOnlyAccess policy. These principals could be either IAM roles (recommended) or IAM users. Then your users who work with Amazon Q Developer operational investigations would sign on with one of these principals. For the following policy, you'll need the ARNs of those three principals. { "Sid": "Enable AI Operations Admin for the DescribeKey permissions", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::{account-id}:role/{AIOpsConsoleAdmin}" }, "Action": [ "kms:DescribeKey" ], "Resource": "*", "Condition": { "StringEquals": { "kms:ViaService": "aiops.{region}.amazonaws.com" } } }, { "Sid": "Enable AI Operations Admin and Operator for the Decrypt and GenerateDataKey permissions", "Effect": "Allow", "Principal": { "AWS": [ "arn:aws:iam::{account-id}:role/{AIOpsConsoleAdmin}", "arn:aws:iam::{account-id}:role/{AIOpsOperator}" ] }, "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], Encryption of investigation data 2034 Amazon CloudWatch "Resource": "*", "Condition": { "StringEquals": { User Guide "kms:ViaService": "aiops.{region}.amazonaws.com" }, "ArnLike": { "kms:EncryptionContext:aws:aiops:investigation-group-arn": "arn:aws:aiops: {region}:{account-id}:investigation-group/*" } } }, { "Sid": "Enable AI Operations ReadOnly for the Decrypt permission", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::{account-id}:role/{AIOpsReadOnly}" }, "Action": [ "kms:Decrypt" ], "Resource": "*", "Condition": { "StringEquals": { "kms:ViaService": "aiops.{region}.amazonaws.com" }, "ArnLike": { "kms:EncryptionContext:aws:aiops:investigation-group-arn": "arn:aws:aiops: {region}:{account-id}:investigation-group/*" } } }, { "Sid": "Enable the AI Operations service to have the DescribeKey permission", "Effect": "Allow", "Principal": { "Service": "aiops.amazonaws.com" }, "Action": [ "kms:DescribeKey" ], "Resource": "*", "Condition": { "StringEquals": { "aws:SourceAccount": "{account-id}" Encryption of investigation data 2035 Amazon CloudWatch }, User Guide "StringLike": { "aws:SourceArn": "arn:aws:aiops:{region}:{account-id}:investigation-group/ *" } } }, { "Sid": "Enable the AI Operations service to have the Decrypt and GenerateDataKey permissions", "Effect": "Allow", "Principal": { "Service": "aiops.amazonaws.com" }, "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "*", "Condition": { "StringEquals": { "aws:SourceAccount": "{account-id}" }, "StringLike": { "aws:SourceArn": "arn:aws:aiops:{region}:{account-id}:investigation-group/ *" }, "ArnLike": { "kms:EncryptionContext:aws:aiops:investigation-group-arn": "arn:aws:aiops: {region}:{account-id}:investigation-group/*" } } }, { "Sid": "Enable CloudWatch to have the Decrypt and GenerateDataKey permissions", "Effect": "Allow", "Principal": { "Service": "aiops.alarms.cloudwatch.amazonaws.com" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "*", Encryption of investigation data 2036 Amazon CloudWatch "Condition": { User Guide
acw-ug-550
acw-ug.pdf
550
data 2035 Amazon CloudWatch }, User Guide "StringLike": { "aws:SourceArn": "arn:aws:aiops:{region}:{account-id}:investigation-group/ *" } } }, { "Sid": "Enable the AI Operations service to have the Decrypt and GenerateDataKey permissions", "Effect": "Allow", "Principal": { "Service": "aiops.amazonaws.com" }, "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "*", "Condition": { "StringEquals": { "aws:SourceAccount": "{account-id}" }, "StringLike": { "aws:SourceArn": "arn:aws:aiops:{region}:{account-id}:investigation-group/ *" }, "ArnLike": { "kms:EncryptionContext:aws:aiops:investigation-group-arn": "arn:aws:aiops: {region}:{account-id}:investigation-group/*" } } }, { "Sid": "Enable CloudWatch to have the Decrypt and GenerateDataKey permissions", "Effect": "Allow", "Principal": { "Service": "aiops.alarms.cloudwatch.amazonaws.com" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "*", Encryption of investigation data 2036 Amazon CloudWatch "Condition": { User Guide "ArnLike": { "kms:EncryptionContext:aws:aiops:investigation-group-arn": "arn:aws:aiops: {region}:{account-id}:investigation-group/*" }, "StringEquals": { "aws:SourceAccount": "{account-id}", "kms:ViaService": "aiops.{region}.amazonaws.com" }, "StringLike": { "aws:SourceArn": "arn:aws:cloudwatch:{region}:{account-id}:alarm:*" } } } After you've updated the policy, assign it to the key by entering the following command. aws kms put-key-policy --key-id key-id --policy-name default --policy file:// policy.json Associate the key with the investigation group When you use the CloudWatch console to create an investigation group, you can choose to associate the AWS KMS key with the investigation group. For more information, see Set up operational investigations. You can also associate a customer managed key with an existing investigation group. Changing your encryption configuration You can update an investigation group to change between using a customer managed key or a service owned key. You can also change from using one customer managed key to using another. When you make such a change, the change applies to new investigations created after the change. Previous investigations are still associated with the old encryption configuration. Current ongoing investigations also continue using the original key for new data. As long as a previously-used key is active and Amazon Q has access to it for investigations, you can retrieve the older investigations encrypted with that method, as well as data in current investigations that was encrypted with the previous key. If you delete a previously-used key or revoke access to it, the investigation data encrypted with that key can't be retrieved. Encryption of investigation data 2037 Amazon CloudWatch Cross-Region inference User Guide Amazon Q Developer operational investigations uses cross-Region inference to distribute traffic across different AWS Region. Although the data remains stored only in the primary Region, when using cross-Region inference, your investigation data might move outside of your primary Region. All data will be transmitted encrypted across Amazon’s secure network. For more information see Cross-Region inference in the Amazon Q Developer user guide. For details about where cross-Region inference distribution occurs for each Region, see the following table. Supported Amazon Q Developer operational investiga tions geography Investigation Region Possible inference Regions United States (US) US East (N. Virginia) US East (N. Virginia), US East (Ohio), US West (Oregon) US East (Ohio) US East (N. Virginia), US East (Ohio), US West (Oregon) US West (Oregon) US East (N. Virginia), US East (Ohio), US West (Oregon) Europe (EU) Europe (Frankfurt) US East (N. Virginia), US East (Ohio), US West (Oregon) Europe (Ireland) US East (N. Virginia), US East (Ohio), US West (Oregon) Europe (Spain) US East (N. Virginia), US East (Ohio), US West (Oregon) Europe (Stockholm) US East (N. Virginia), US East (Ohio), US West (Oregon) Asia-Pacific (AP) Asia Pacific (Hong Kong) US East (N. Virginia), US East (Ohio), US West (Oregon) Cross-Region inference 2038 Amazon CloudWatch User Guide Investigation Region Possible inference Regions Supported Amazon Q Developer operational investiga tions geography Asia Pacific (Mumbai) US East (N. Virginia), US East (Ohio), US West (Oregon) Asia Pacific (Singapor e) US East (N. Virginia), US East (Ohio), US West (Oregon) Asia Pacific (Sydney) US East (N. Virginia), US East (Ohio), US West (Oregon) Asia Pacific (Tokyo) US East (N. Virginia), US East (Ohio), US West (Oregon) Troubleshooting Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Spain) Troubleshooting 2039 Amazon CloudWatch • Europe (Stockholm) Topics User Guide • Amazon Q Developer cannot assume the necessary IAM roles or permissions. Please verify required roles and permissions are correctly configured • Unable to identify event source. Verify that the resource exists in your application topology and the resource type is supported. • Analysis complete. Submit additional findings to receive updated suggestions Amazon Q Developer cannot assume the necessary IAM roles or permissions. Please verify required roles and permissions are correctly configured Amazon Q Developer operational investigations use an IAM role to be able to access information in your topology. This IAM role must be configured with adequate permissions. For more information about the necessary
acw-ug-551
acw-ug.pdf
551
assume the necessary IAM roles or permissions. Please verify required roles and permissions are correctly configured • Unable to identify event source. Verify that the resource exists in your application topology and the resource type is supported. • Analysis complete. Submit additional findings to receive updated suggestions Amazon Q Developer cannot assume the necessary IAM roles or permissions. Please verify required roles and permissions are correctly configured Amazon Q Developer operational investigations use an IAM role to be able to access information in your topology. This IAM role must be configured with adequate permissions. For more information about the necessary permissions, see How to control what data Amazon Q Developer has access to during investigations. Unable to identify event source. Verify that the resource exists in your application topology and the resource type is supported. There are several AWS services and features that we recommend you to enable to provide additional valuable information to Amazon Q Developer. These services and features can help Amazon Q Developer identify event sources. For more information, see (Recommended) Best practices to enhance investigations. Analysis complete. Submit additional findings to receive updated suggestions When you see this message, Amazon Q Developer has finished analyzing your topology and telemetry based on the findings that it has found so far. If you think that the root cause hasn't been found, you can manually add more telemetry to the investigation, and this might cause Amazon Q Developer to scan your system again based on the new information. Amazon Q Developer cannot assume the necessary IAM roles or permissions. Please verify required roles and permissions are correctly configured 2040 Amazon CloudWatch User Guide To add new telemetry, navigate to that service's console and add the telemetry to the investigation. For example, to add a Lambda metric to the investigation, you can do the following: 1. Open the Lambda console. 2. In the Monitor section, find the metric. 3. Open the vertical ellipsis context menu for the metric, choose Investigate, Add to investigation Then, in the Investigate pane, select the name of the investigation. Integrations with other systems Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Spain) • Europe (Stockholm) Topics • Integration with AWS Systems Manager Automation • Third-party ticketing systems Integrations with other systems 2041 Amazon CloudWatch User Guide • Integration with third-party chat systems • AWS IAM Identity Center Integration with AWS Systems Manager Automation Amazon Q Developer operational investigations is integrated with Automation, a capability of AWS Systems Manager. You don't need to configure integration, but you might need to update AWS Identity and Access Management (IAM) permissions so you can use Automation runbooks. What is AWS Systems Manager? Systems Manager helps you centrally view, manage, and operate managed nodes at scale in AWS, on-premises, and multicloud environments. In Systems Manager, a managed node is any machine configured for use with Systems Manager. For information, see the AWS Systems Manager User Guide. What is Systems Manager Automation? Automation performs common maintenance, deployment, troubleshooting, and remediation tasks through the use of runbooks. Each runbook defines a number of steps for performing tasks. Each step is associated with a particular action. The action determines the inputs, behavior, and outputs of the step. For descriptions of the nearly two dozen actions that are supported for runbooks, see the Systems Manager Automation actions reference in the AWS Systems Manager User Guide. Automation provides over 400 AWS managed runbooks. For details about each runbook, including a step-by-step description of the actions performed when executed, see the Systems Manager Automation runbook reference. Customers can also design their own runbooks to address specific scenarios in their environments. For information, see Creating your own runbooks in the AWS Systems Manager User Guide. For information about working with runbooks in an investigation, see Reviewing and executing suggested runbook remediations for Amazon Q Developer operational investigations. Third-party ticketing systems In the US East (N. Virginia) Region, you can integrate Amazon Q Developer operational investigations with a third-party ticketing system. Integrating with a ticketing tool enables Amazon Q Developer to send information about an investigation to that ticketing tool. For information Integration with AWS Systems Manager Automation 2042 Amazon CloudWatch User Guide about how to create this integration when you create an investigation group, see step 11b in Set up operational investigations. This feature is available only in the US East (N. Virginia) Region. Integration with third-party chat systems By integrating Amazon Q Developer operational investigations with Amazon
acw-ug-552
acw-ug.pdf
552
ticketing systems In the US East (N. Virginia) Region, you can integrate Amazon Q Developer operational investigations with a third-party ticketing system. Integrating with a ticketing tool enables Amazon Q Developer to send information about an investigation to that ticketing tool. For information Integration with AWS Systems Manager Automation 2042 Amazon CloudWatch User Guide about how to create this integration when you create an investigation group, see step 11b in Set up operational investigations. This feature is available only in the US East (N. Virginia) Region. Integration with third-party chat systems By integrating Amazon Q Developer operational investigations with Amazon Q Developer in chat applications, you can have updates from investigations sent to third-party chat services, including Slack, and Microsoft Teams. The integration is facilitated by Amazon Simple Notification Service. To integrate with Amazon Q Developer in chat applications, you must complete three steps. We recommend completing the steps in the following order. • Create an Amazon SNS topic and add an access policy to it • Configure in the Amazon Q Developer in chat applications console • Configure in the CloudWatch console Topics • Create and configure the Amazon SNS topic • Configure Amazon Q Developer in chat applications • Amazon SNS Create and configure the Amazon SNS topic Create an Amazon SNS topic in US East (N. Virginia) to use for the integration. For more information, see Creating an Amazon Simple Notification Service topic. To enable Amazon Q Developer operational investigations to send notifications, you must add an the following access policy to the Amazon SNS topic { "Sid": "AIOPS-CHAT-PUBLISH", "Effect": "Allow", "Principal": { "Service": "aiops.amazonaws.com" }, "Action": "sns:Publish", Integration with third-party chat systems 2043 Amazon CloudWatch User Guide "Resource": "SNS-TOPIC-ARN", "Condition": { "StringEquals": { "aws:SourceAccount": "account-Id" } } } Configure Amazon Q Developer in chat applications To configure Amazon Q Developer in chat applications for communication with a third-party chat service, follow the instructions in one of the following links: • Tutorial: Get started with Slack. • Tutorial: Get started with Microsoft Teams. Then, to support using AI assistant actions within chat channels you must provide the Amazon Q Developer in chat applications role with appropriate permissions. When you create a new IAM channel role for the channel, select the Notifications and Amazon Q operations assistant permissions policy templates. Attach the AIOpsOperatorAccess managed IAM policy to the guardrail policies in Amazon Q Developer in chat applications. This grants permissions to Amazon Q Developer in chat applications to interact with Amazon Q Developer operational investigations and perform required actions on your behalf. In the channel configuration, you must also subscribe to the Amazon SNS topic that you created in the previous step. Amazon SNS You must use the CloudWatch console to configure Amazon Q Developer operational investigations to integrate with Amazon SNS. You can do this while you create the investigation group in your account, or later. For information about completing the step while you create the investigation group, see Step 9b at Set up operational investigations. If you have already created an investigation group and want to add chat integration, follow these steps. Integration with third-party chat systems 2044 Amazon CloudWatch User Guide To add chat integration to an existing investigation group 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. Choose AI operations, Configuration. 3. Choose the Third-party integrations tab. 4. In the Chat integration section, do the following: • If you have already integrated Amazon Q Developer in chat applications with a third-party chat system, you can choose Select SNS topic to choose the Amazon SNS topic to use to send updates to about investigations. This Amazon SNS topic will relay those updates to the chat client. • If you want to integrate Amazon Q Developer in chat applications with a third-party chat system, choose Configure new chat client. For more information about setting up this configuration, see Getting started with Amazon Q Developer in chat applications. AWS IAM Identity Center In the US East (N. Virginia) Region, you can integrate Amazon Q Developer operational investigations with AWS IAM Identity Center. Before you create an Amazon Q Developer operational investigations application in IAM Identity Center, make sure you complete the following prerequisites: • Enable an organization-level IAM Identity Center instance in your management account and connect the identity source in IAM Identity Center. Amazon Q Developer operational investigations doesn't support account-level IAM Identity Center instances. Note To minimize latency, we recommend that you use an IAM Identity Center instance created in the same Region as your Amazon Q Developer operational investigations application. However, you can also use an IAM Identity Center instance created in an AWS Region not yet supported by Amazon Q Developer operational investigations. For more information, see Cross-Region IAM Identity Center integration. • Enable the identity-aware session on your IAM Identity Center instance.
acw-ug-553
acw-ug.pdf
553
IAM Identity Center instance in your management account and connect the identity source in IAM Identity Center. Amazon Q Developer operational investigations doesn't support account-level IAM Identity Center instances. Note To minimize latency, we recommend that you use an IAM Identity Center instance created in the same Region as your Amazon Q Developer operational investigations application. However, you can also use an IAM Identity Center instance created in an AWS Region not yet supported by Amazon Q Developer operational investigations. For more information, see Cross-Region IAM Identity Center integration. • Enable the identity-aware session on your IAM Identity Center instance. AWS IAM Identity Center 2045 Amazon CloudWatch User Guide Cross-Region IAM Identity Center integration Amazon Q Developer operational investigations can integrate with IAM Identity Center in any commercial region where IAM Identity Center is available, including opt-in Regions. This integration works even if the Region isn't directly supported by Amazon Q Developer operational investigations. You have the flexibility to use an IAM Identity Center instance configured in a Rgion different from where Amazon Q Developer operational investigations is available. When your IAM Identity Center instance is in a different Region than Amazon Q Developer operational investigations, you enable Amazon Q to make inter-Region calls to access information from your IAM Identity Center instance, such as user and application attributes. This capability allows Amazon Q Developer operational investigations to support IAM Identity Center-enabled applications regardless of regional differences. In this setup, your Amazon Q Developer operational investigations application will have access to user and application information from an IAM Identity Center instance deployed in another Region. If your IAM Identity Center instance is in a different Region than your Amazon Q Developer operational investigations application, you might experience higher latency when using Amazon Q Developer operational investigations. This is caused by the increased overhead of making inter- Region calls. The increase in latency will be proportional to the distance between the two Regions. (Recommended) Best practices to enhance investigations As a best practice, we recommend that you enable several AWS services and features in your account that can help Amazon Q Developer discover more information in your topology and make better suggestions during investigations. Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) (Recommended) Best practices to enhance investigations 2046 Amazon CloudWatch User Guide • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) • Europe (Spain) • Europe (Stockholm) Topics • CloudWatch agent • AWS CloudTrail • CloudWatch Application Signals • X-Ray • Container insights CloudWatch agent We recommend that you install the latest version of the CloudWatch agent on your servers. Using a recent version of the CloudWatch agent enhances the ability to find issues in Amazon EC2 and Amazon EBS during investigations. At a minimum, you should use Version 1.300049.1 or later of the CloudWatch agent. For more information about the CloudWatch agent and how to install it, see Collect metrics, logs, and traces with the CloudWatch agent. AWS CloudTrail We recommend that you enable CloudTrail including trails in your investigations. CloudTrail records events about changes in your system including deployment events. These events can often be useful to Amazon Q Developer to create hypotheses about root causes of issues in your system. For more information, see What is AWS CloudTrail and Working with CloudTrail trails. CloudWatch Application Signals CloudWatch Application Signals discovers the topology of your environment, including your applications and their dependencies. It also automatically collects standard metrics such as latency CloudWatch agent 2047 Amazon CloudWatch User Guide and availability. By enabling Application Signals, Amazon Q Developer can use this topology and metric information during investigations. For more information about application signals, see Application Signals. X-Ray We recommend that you enable AWS X-Ray. X-Ray collects traces about requests that your applications serve. For any traced request to your application, you can see detailed information not only about the request and response, but also about calls that your application makes to downstream AWS resources, microservices, databases, and web APIs. This information can help Amazon Q Developer during investigations. For more information, see What is AWS X-Ray Container insights If you use Amazon ECS or Amazon EKS, we recommend that you install Container insights. This improves the ability of Amazon Q Developer to find issues in your containers. For more information about the CloudWatch agent and how to install it, see Container Insights. Operational investigation data retention Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions:
acw-ug-554
acw-ug.pdf
554
downstream AWS resources, microservices, databases, and web APIs. This information can help Amazon Q Developer during investigations. For more information, see What is AWS X-Ray Container insights If you use Amazon ECS or Amazon EKS, we recommend that you install Container insights. This improves the ability of Amazon Q Developer to find issues in your containers. For more information about the CloudWatch agent and how to install it, see Container Insights. Operational investigation data retention Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) X-Ray 2048 Amazon CloudWatch User Guide • Europe (Ireland) • Europe (Spain) • Europe (Stockholm) The retention period that you set for an investigation group determines how long that investigation data is kept. Valid values are seven days to 90 days. After you first create an investigation, if you don't end it manually, it moves to a CLOSED state automatically after seven days. Then, the retention period determines how long the data is kept after the investigation moves to the CLOSED state. The data that is kept during the retention period includes the data in the investigation, accepted and discarded findings, and AI assistant audit log messages. When this retention period expires, the investigation data is deleted. If you manually end an investigation, that also moves the investigation to the CLOSED state and the retention period time begins to be in effect. Insights that Amazon Q Developer can surface in investigations Note The Amazon Q Developer operational investigations feature is in preview release and is subject to change. It is currently available in the following Regions: • US East (N. Virginia) • US East (Ohio) • US West (Oregon) • Asia Pacific (Hong Kong) • Asia Pacific (Mumbai) • Asia Pacific (Singapore) • Asia Pacific (Sydney) • Asia Pacific (Tokyo) • Europe (Frankfurt) • Europe (Ireland) Insights that Amazon Q Developer can surface in investigations 2049 Amazon CloudWatch User Guide • Europe (Spain) • Europe (Stockholm) Amazon Q Developer can surface the following types of items and add them to the Suggestions tab of an investigation. • Hypotheses about root causes • CloudWatch alarms, including both metric alarms and composite alarms • CloudWatch metrics • AWS Health events • Change events logged in CloudTrail • X-Ray trace data • CloudWatch Logs Insights queries for log groups in the Standard log class • CloudWatch Contributor Insights data • CloudWatch Application Signals data Insights that Amazon Q Developer can surface in investigations 2050 Amazon CloudWatch User Guide OpenTelemetry OpenTelemetry is an open-source observability framework that provides IT teams with standardized protocols and tools for collecting and routing telemetry data. It delivers a unified format for instrumenting, generating, gathering, and exporting application telemetry data, such as metrics, logs, and traces to monitoring platforms for analysis and insights. By using OpenTelemetry, you can avoid vendor lock-in, ensuring flexibility in the observability solutions. You can use OpenTelemetry to directly send logs and traces to an OpenTelemetry Protocol (OTLP) endpoint, and get out-of-the box features like Logs Insights, LiveTail, and application performance monitoring experiences in CloudWatch Application Signals. Application Signals provides you with a unified, application-centric view of your applications, services, and dependencies, and helps you monitor and triage application health. You can also explore OTLP spans using the interactive search and analytics experience in CloudWatch to answer any questions related to application performance or end-user impact with Transaction Search. You can also detect the impact on end users, find transactions in context of those issues using relevant attributes such as customer name or order number, correlate transactions to business events such as failed payments, and dive into interactions between application components to establish a root cause. Using CloudWatch, you can get complete application transaction coverage with correlated insights, helping you to accelerate mean time to resolution. Topics • OTLP Endpoints • Getting started • Troubleshooting 2051 Amazon CloudWatch OTLP Endpoints User Guide OpenTelemetry Protocol (OTLP) is a general-purpose telemetry data delivery protocol designed for the OpenTelemetry. CloudWatch OpenTelemetry endpoints are HTTP 1.1 endpoints. You need to configure your OpenTelemetry collector to start sending open telemetry data to CloudWatch. For more information, see Getting started. The endpoint authenticates callers using Signature 4 authentication. For more information, see AWS Signature Version 4 for API requests. Traces endpoint The traces endpoint follows the pattern https://xray.AWS Region.amazonaws.com/ v1/traces. For example, for the US West (Oregon) (us-west-2) Region, the endpoint will be https://xray.us-west-2.amazonaws.com/v1/traces. You need to configure your OpenTelemetry collector to start sending traces to CloudWatch. To get started, see Getting started. Logs
acw-ug-555
acw-ug.pdf
555
telemetry data delivery protocol designed for the OpenTelemetry. CloudWatch OpenTelemetry endpoints are HTTP 1.1 endpoints. You need to configure your OpenTelemetry collector to start sending open telemetry data to CloudWatch. For more information, see Getting started. The endpoint authenticates callers using Signature 4 authentication. For more information, see AWS Signature Version 4 for API requests. Traces endpoint The traces endpoint follows the pattern https://xray.AWS Region.amazonaws.com/ v1/traces. For example, for the US West (Oregon) (us-west-2) Region, the endpoint will be https://xray.us-west-2.amazonaws.com/v1/traces. You need to configure your OpenTelemetry collector to start sending traces to CloudWatch. To get started, see Getting started. Logs endpoint The logs endpoint follows the pattern https://logs.AWS Region.amazonaws.com/v1/ logs. For example, for the US West (Oregon) (us-west-2) Region, the endpoint will be https://logs.us-west-2.amazonaws.com/v1/logs. You can use the above endpoint to forward logs to an existing LogGroup and LogStream. For more information on setting up LogGroup to ingest log data, see Amazon CloudWatch Logs concepts. You must configure LogGroup and LogStream when you invoke CloudWatch Logs OpenTelemetry endpoint by setting x-aws-log-group and x-aws-log-stream HTTP headers to LogGroup and LogStream name respectively. For more information, see Getting started. Endpoint limits and restrictions The table lists the common endpoint limits and restrictions for traces and logs. Limit Endpoint Required collector extension sigv4authextension Additional informati on To send traces to OTLP endpoint you OTLP Endpoints 2052 Amazon CloudWatch Limit Endpoint Supported protocol HTTP Supported OTLP versions Payload format OTLP 1.x binary, json Compression methods gzip, none The table lists the endpoint limits and restrictions for traces. Limit Traces endpoint Maximum uncompressed bytes / request 5 MB Maximum events / request 10,000 spans User Guide Additional informati on must use sigv4auth extension The endpoint supports only HTTP and doesn't support gRPC The endpoint accepts requests using binary and json formats The endpoint only supports gzip and none compression methods Additional informati on The OTLP endpoint will reject requests larger than 5MB when payload is uncompressed. The max allowed number of spans in one request is 10,000. Exceeding this limit will cause Endpoint limits and restrictions 2053 Amazon CloudWatch Limit Traces endpoint Single resource and scope size 16 KB Single span maximum size 200 KB User Guide Additional informati on rejection of the API call. Each unique resource and corresponding scope should not exceed 16 KB of size. Exceeding this limit for any resource will cause rejection of the entire API call. Spans more than 200KB will be rejected by the endpoint. Span created timestamps 2 hours in the future and 14 days in the None of the spans in the batch can be past more than two hours in the future or more than 14 days in the past. Maximum time gap in events / request 24 hours The table lists the endpoint limits and restrictions for logs. Limit Logs endpoint Maximum uncompressed bytes / request 1 MB Additional informati on The OTLP endpoint will reject requests larger than 1MB Endpoint limits and restrictions 2054 Amazon CloudWatch Limit Logs endpoint Request per second 5000 Maximum events / request 10,000 logs User Guide Additional informati on when payload is uncompressed. The maximum request size is 1,048,576 bytes after decompression and deserialization of binary data serialize d by Protocol buffers. This size is calculate d as the sum of all event messages in UTF-8, plus 26 bytes for each log record. 5000 transactions per second per account per Region You can request an increase to the per-second throttling quota by using the Service Quotas service. The max allowed number of spans in one request is 10,000. Exceeding this limit will cause rejection of the API call. Endpoint limits and restrictions 2055 Amazon CloudWatch Limit Logs endpoint Single resource and scope size 16 KB Single LogEvent size 1 MB User Guide Additional informati on Each unique resource and corresponding scope should not exceed 16 KB of size. Exceeding this limit for any resource will cause rejection of the entire API call. LogEvent size is calculated as sum of sizes for each LogRecord, Scope and Resource. This quota can't be changed. Logs created timestamps 2 hours in future and 14 days old The log records in the batch does not have to be in a chronolog ical order. However, the log records in the batch cannot be more than 2 hours in the future and cannot be more than 14 days in the past. Also, none of the log records can be earlier than the retention period of the log group. Maximum time gap in events / request 24 hours Endpoint limits and restrictions 2056 Amazon CloudWatch Note User Guide The account limits for Logs are shared across the SDK and the new Logs endpoint. Getting started To get started with OpenTelemetry in CloudWatch, you can use the pre-packaged OpenTelemetry setup that is available with the CloudWatch agent
acw-ug-556
acw-ug.pdf
556
However, the log records in the batch cannot be more than 2 hours in the future and cannot be more than 14 days in the past. Also, none of the log records can be earlier than the retention period of the log group. Maximum time gap in events / request 24 hours Endpoint limits and restrictions 2056 Amazon CloudWatch Note User Guide The account limits for Logs are shared across the SDK and the new Logs endpoint. Getting started To get started with OpenTelemetry in CloudWatch, you can use the pre-packaged OpenTelemetry setup that is available with the CloudWatch agent along with the AWS Distro for OpenTelemetry SDKs. This gives you the most integrated monitoring experience in CloudWatch. Note Make sure Transaction Search is enabled before you use the OTLP Endpoint. Alternatively, you have the flexibility to use the OpenTelemetry Collector or your own custom OpenTelemetry Collector to directly send telemetry to the OTLP endpoint. You can use the AWS Distro for OpenTelemetry to go collector-less and to send telemetry directly to the OTLP endpoint. Make an informed choice based on the feature support: Feature OpenTelemetry Collector Contrib Custom OpenTelem etry Collector AWS Distro for OpenTelemetry Yes Yes Yes CloudWatch applicati on signals (Applicat ion performance metrics, service discovery, and service map) Search and analyze spans and trace summaries Search and analyze logs summaries Yes Yes Yes Yes Yes Yes Getting started 2057 OpenTelemetry Collector Contrib Custom OpenTelem etry Collector AWS Distro for OpenTelemetry No Yes Yes User Guide No Yes No Amazon CloudWatch Feature Application performance monitoring telemetry enrichment with AWS infrastructure attributes that your application is hosted in. Runtime metrics correlated with your application. For example, JVM metrics AWS Support Data received by AWS Data received by AWS Data received by AWS Telemetry supported Logs, Traces Logs, Traces, Metrics Traces Topics • OpenTelemetry Collector Contrib • Build your own custom OpenTelemetry Collector • AWS Distro for OpenTelemetry OpenTelemetry Collector Contrib You can use the OpenTelemetry Collector Contrib to get started with OpenTelemetry in CloudWatch. Prerequisite Make sure Transaction Search is enabled in CloudWatch. For more information, see Transaction Search. OpenTelemetry Collector Contrib 2058 Amazon CloudWatch User Guide Download the OpenTelemetry Collector Contrib Download the latest release of the OpenTelemetry Collector Contrib distribution. Install the OpenTelemetry Collector Contrib Install the OpenTelemetry Collector Contrib on any operating system and platform. For more information, see Install the Collector. Setup AWS credentials on your Amazon EC2 or on-premise hosts You can setup AWS credentials on your Amazon EC2 or on-premise hosts. Setup IAM permissions for Amazon EC2 Follow the below procedure to attach the CloudWatchAgentServerPolicy IAM policy to the IAM role of your Amazon EC2 instance. 1. Open the IAM console at https://console.aws.amazon.com/iam/. 2. Choose Roles and find and select the role used by your Amazon EC2 instance. 3. Under the Permissions tab, choose Add permissions, Attach policies. 4. Using the search box, search for CloudWatchAgentServerPolicy policy. 5. Select the CloudWatchAgentServerPolicy policy and choose Add permissions. Setup IAM permissions for on-premise hosts You can create an IAM user that can be used to provide permissions to your on-premise hosts. 1. Open the IAM console at https://console.aws.amazon.com/iam/. 2. Choose Users, Create User. 3. Under User details,for User name, enter a name for the new IAM user. This is the sign-in name for AWS that will be used to authenticate your host. 4. Choose Next. 5. On the Set permissions page, under Permissions options, select Attach policies directly. 6. From the Permissions policies list, select the CloudWatchAgentServerPolicy policy to add to your user. OpenTelemetry Collector Contrib 2059 Amazon CloudWatch 7. Choose Next. User Guide 8. On the Review and create page, ensure that you are satisfied with the user name and that the CloudWatchAgentServerPolicy policy is under the Permissions summary. 9. Choose Create user. 10. Create and retrieve your AWS access key and secret key – In the navigation pane in the IAM console, choose Users and then select the user name of the user that you created in the previous step. 11. On the user's page, choose the Security credentials tab. 12. Under the Access keys section, choose Create access key. 13. For Create access key Step 1, choose Command Line Interface (CLI). 14. For Create access key Step 2, optionally enter a tag and then choose Next. 15. For Create access key Step 3, select Download .csv file to save a .csv file with your IAM user's access key and secret access key. You need this information for the next steps. 16. Choose Done. 17. Configure your AWS credentials in your on-premises host by entering the following command. Replace ACCESS_KEY_ID and SECRET_ACCESS_ID with your newly generated access key and secret access key from the .csv file that you downloaded in the previous step. $ aws configure AWS Access Key ID [None]: ACCESS_KEY_ID
acw-ug-557
acw-ug.pdf
557
14. For Create access key Step 2, optionally enter a tag and then choose Next. 15. For Create access key Step 3, select Download .csv file to save a .csv file with your IAM user's access key and secret access key. You need this information for the next steps. 16. Choose Done. 17. Configure your AWS credentials in your on-premises host by entering the following command. Replace ACCESS_KEY_ID and SECRET_ACCESS_ID with your newly generated access key and secret access key from the .csv file that you downloaded in the previous step. $ aws configure AWS Access Key ID [None]: ACCESS_KEY_ID AWS Secret Access Key [None]: SECRET_ACCESS_ID Default region name [None]: MY_REGION Default output format [None]: json Setup AWS credentials for your Amazon EKS or Kubernetes clusters To setup AWS credentials for your Amazon EKS or Kubernetes clusters to send telemetry to CloudWatch, follow the below procedure. Setup IAM permissions for Amazon EKS 1. Create an IAM OIDC identity provider for your cluster using the following command. OpenTelemetry Collector Contrib 2060 Amazon CloudWatch User Guide eksctl utils associate-iam-oidc-provider --cluster ${CLUSTER_NAME} --region ${REGION} --approve 2. Assign IAM roles to Kubernetes service account for OTel Collector using the following command. eksctl create iamserviceaccount \ --name ${COLLECTOR_SERVICE_ACCOUNT}\ --namespace ${NAMESPACE} \ --cluster ${CLUSTER_NAME} \ --region ${REGION} \ --attach-policy-arn arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy \ --approve \ --override-existing-serviceaccounts Setup IAM permissions for Kubernetes 1. Configure your AWS credentials in your on-premises host by entering the following command. Replace ACCESS_KEY_ID and SECRET_ACCESS_ID with your newly generated access key and secret access key from the .csv file that you downloaded in the previous step. By default, the credential file is saved under /home/user/.aws/credentials.. aws configure AWS Access Key ID [None]: ACCESS_KEY_ID AWS Secret Access Key [None]: SECRET_ACCESS_ID Default region name [None]: MY_REGION Default output format [None]: json 2. Edit OpenTelemetry Collector resource to add the newly created AWS credentials secret by using the command: kubectl edit OpenTelemetryCollector otel_collector 3. Using the file editor, add the AWS credentials into the OpenTelemetryCollector container by adding the following configuration to the top of the deployment. Replace the path / home/user/.aws/credentials with the location of your local AWS credentials file. spec: OpenTelemetry Collector Contrib 2061 Amazon CloudWatch User Guide volumeMounts: - mountPath: /rootfs volumeMounts: - name: aws-credentials mountPath: /root/.aws readOnly: true volumes: - hostPath: path: /home/user/.aws/credentials name: aws-credentials Configure the OpenTelemetry Collector Copy and paste the content below to configure your collector to send logs and traces to the OTLP endpoints. receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 http: endpoint: 0.0.0.0:4318 exporters: otlphttp/logs: compression: gzip logs_endpoint: logs_otlp_endpoint headers: x-aws-log-group: ency_log_group x-aws-log-stream: default auth: authenticator: sigv4auth/logs otlphttp/traces: compression: gzip traces_endpoint: traces_otlp_endpoint auth: authenticator: sigv4auth/traces extensions: OpenTelemetry Collector Contrib 2062 User Guide Amazon CloudWatch sigv4auth/logs: region: "region" service: "logs" sigv4auth/traces: region: "region" service: "xray" service: telemetry: extensions: [sigv4auth/logs, sigv4auth/traces] pipelines: logs: receivers: [otlp] exporters: [otlphttp/logs] traces: receivers: [otlp] exporters: [otlphttp/traces] The following is an example to send logs and traces using sigv4 to us-east-1. receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 http: endpoint: 0.0.0.0:4318 exporters: otlphttp/logs: compression: gzip logs_endpoint: https://logs.us-east-1.amazonaws.com/v1/logs headers: x-aws-log-group: MyApplicationLogs x-aws-log-stream: default auth: authenticator: sigv4auth/logs otlphttp/traces: compression: gzip traces_endpoint: https://xray.us-east-1.amazonaws.com/v1/traces OpenTelemetry Collector Contrib 2063 Amazon CloudWatch auth: authenticator: sigv4auth/traces User Guide extensions: sigv4auth/logs: region: "us-east-1" service: "logs" sigv4auth/traces: region: "us-east-1" service: "xray" service: telemetry: extensions: [sigv4auth/logs, sigv4auth/traces] pipelines: logs: receivers: [otlp] exporters: [otlphttp/logs] traces: receivers: [otlp] exporters: [otlphttp/traces] Note Configure your OpenTelemetry SDKs to always_on sampling configuration to reliably record 100% spans and get full visibility into your critical applications with CloudWatch Application Signals. For more information, see an OpenTelemetry Java SDK sampler configuration example. For an example on setting up OpenTelemetry Collector with X-Ray OTLP endpoint, see the application signals demo repository. Build your own custom OpenTelemetry Collector You can build your own custom OpenTelemetry Collector to get the best application observability experience in CloudWatch with OpenTelemetry. In this setup, you need to build your own OpenTelemetry Collector with open source CloudWatch components. Build your own custom OpenTelemetry Collector 2064 Amazon CloudWatch Prerequisite User Guide Make sure Transaction Search is enabled in CloudWatch. For more information, see Transaction Search. Build your own collector You can build your own collector with the following configuration to monitor your application in CloudWatch with OpenTelemetry. For more information, see Building a custom collector. The common configuration for CloudWatch. dist: name: otelcol-dev description: OTel Collector for sending telemetry to CloudWatch. output_path: ./otelcol-dev extensions: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/ sigv4authextension v0.111.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.113.0 exporters: - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.111.0 - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.111.0 receivers: - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.111.0 Additional configuration for traces. # Enable Tracing dist: name: otelcol-dev description: OTel Collector for sending telemetry to CloudWatch. output_path: ./otelcol-dev extensions: #Include common configurations and your custom extensions exporters: #Include common configurations and your custom extensions Build your own custom OpenTelemetry Collector 2065 Amazon CloudWatch receivers: User Guide - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.111.0 processors: - gomod:
acw-ug-558
acw-ug.pdf
558
a custom collector. The common configuration for CloudWatch. dist: name: otelcol-dev description: OTel Collector for sending telemetry to CloudWatch. output_path: ./otelcol-dev extensions: - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/ sigv4authextension v0.111.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy v0.113.0 exporters: - gomod: go.opentelemetry.io/collector/exporter/otlpexporter v0.111.0 - gomod: go.opentelemetry.io/collector/exporter/otlphttpexporter v0.111.0 receivers: - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.111.0 Additional configuration for traces. # Enable Tracing dist: name: otelcol-dev description: OTel Collector for sending telemetry to CloudWatch. output_path: ./otelcol-dev extensions: #Include common configurations and your custom extensions exporters: #Include common configurations and your custom extensions Build your own custom OpenTelemetry Collector 2065 Amazon CloudWatch receivers: User Guide - gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.111.0 processors: - gomod: github.com/amazon-contributing/opentelemetry-collector-contrib/processor/ awsapplicationsignalsprocessor v0.113.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/ resourcedetectionprocessor v0.113.0 - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/processor/ metricstransformprocessor v0.113.0 replaces: - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.113.0 => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/ aws/awsutil v0.113.0 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.113.0 => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/ aws/cwlogs v0.113.0 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter v0.113.0 => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/ awsemfexporter v0.113.0 - github.com/openshift/api v3.9.0+incompatible => github.com/openshift/api v0.0.0-20180801171038-322a19404e37 Note Note the following: • After the collector is built, deploy and configure the custom collector in a host or kubernetes environment by following the procedure under OpenTelemetry Collector Contrib. • For information on setting up custom OpenTelemetry collector with Application Signals Processor, see an Application Signals custom configurationexample. Application Signals Processor only supports the latest versions of the OpenTelemetry Collectors for custom builds. For information on the supported versions, see opentelemetry-collector-contrib repository. AWS Distro for OpenTelemetry You can use the AWS Distro for OpenTelemetry to go collector-less and to send traces directly to the OTLP endpoint (for traces). AWS Distro for OpenTelemetry 2066 Amazon CloudWatch Note User Guide By default, Application Signals is enabled when you enable Transaction Search. Application Signals is not supported on AWS Distro for OpenTelemetry and must be disabled. Topics • Prerequisite • Set up IAM permissions for Amazon EC2 • Set up IAM permissions for on-premise hosts • Enabling AWS Distro for OpenTelemetry Prerequisite Make sure Transaction Search is enabled to send spans to the X-Ray OTLP endpoint. For more information, see Getting started with Transaction Search. Set up IAM permissions for Amazon EC2 Follow these steps to attach the AWSXrayWriteOnlyPolicy IAM policy to the IAM role of your Amazon EC2 instance: 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. Choose Roles and find and select the role used by your Amazon EC2 instance. 3. Under the Permissions tab, choose Add permissions, then Attach policies. 4. Using the search box, search for the AWSXrayWriteOnlyPolicy policy. 5. Select the AWSXrayWriteOnlyPolicy policy and choose Add permissions. Set up IAM permissions for on-premise hosts Follow these steps to create an IAM user that can be used to provide permissions to your on- premise hosts. 1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/. 2. Choose Users and then Create User. AWS Distro for OpenTelemetry 2067 Amazon CloudWatch 3. Choose Users, Create User. User Guide 4. Under User details, for User name, enter a name for the new IAM user. This is the sign-in name for AWS that will be used to authenticate your host. 5. Choose Next. 6. On the Set permissions page, under Permissions options, select Attach policies directly. 7. From the Permissions policies list, select the AWSXrayWriteOnlyPolicy policy to add to your user. 8. Choose Next. 9. On the Review and create page, make sure that you are satisfied with the user name and that the AWSXrayWriteOnlyPolicy policy is under the Permissions summary. 10. Choose Create user. 11. Create and retrieve your AWS access key and secret key: 1. In the navigation pane in the IAM console, choose Users and then select the user name of the user that you created in the previous step. 2. On the user's page, choose the Security credentials tab. 3. Under the Access keys section, choose Create access key. 4. For Create access key Step 1, choose Command Line Interface (CLI). 5. For Create access key Step 2, optionally enter a tag and then choose Next. 6. For Create access key Step 3, select Download .csv file to save a .csv file with your IAM user's access key and secret access key. You need this information for the next steps. 7. Choose Done. 12. Configure your AWS credentials in your on-premises host by entering the following command. Replace ACCESS_KEY_ID and SECRET_ACCESS_ID with your newly generated access key and secret access key from the .csv file that you downloaded in the previous step. $ aws configure AWS Access Key ID [None]: ACCESS_KEY_ID AWS Secret Access Key [None]: SECRET_ACCESS_ID Default region name [None]: MY_REGION Default output format [None]: json AWS Distro for OpenTelemetry 2068 Amazon CloudWatch User Guide Enabling AWS Distro for OpenTelemetry You can enable traces for your application to be sent directly to the OTLP endpoint from AWS Distro for OpenTelemetry on Java, Node.js, Python, and .Net. Java 1. Download the latest version of the AWS Distro for OpenTelemetry Java auto- instrumentation agent. You can download the latest version by
acw-ug-559
acw-ug.pdf
559
key from the .csv file that you downloaded in the previous step. $ aws configure AWS Access Key ID [None]: ACCESS_KEY_ID AWS Secret Access Key [None]: SECRET_ACCESS_ID Default region name [None]: MY_REGION Default output format [None]: json AWS Distro for OpenTelemetry 2068 Amazon CloudWatch User Guide Enabling AWS Distro for OpenTelemetry You can enable traces for your application to be sent directly to the OTLP endpoint from AWS Distro for OpenTelemetry on Java, Node.js, Python, and .Net. Java 1. Download the latest version of the AWS Distro for OpenTelemetry Java auto- instrumentation agent. You can download the latest version by using this command: curl -L -O https://github.com/aws-observability/aws-otel-java-instrumentation/ releases/latest/download/aws-opentelemetry-agent.jar To view all the released versions, see aws-otel-java-instrumentation releases. 2. To enable the exporter that directly sends traces to the X-Ray OTLP traces endpoint and to optimize benefits, use the environment variables to provide additional information before you start your application. 3. For the OTEL_RESOURCE_ATTRIBUTES variable, specify the following information as key- value pairs: (Optional) service.name sets the name of the service. This will be displayed as the service name for your application in Application Signals dashboards. When you don't provide a value for this key, the default of UnknownService is used. (Optional) deployment.environment sets the environment that the application runs in. This will be diplayed as the Hosted In environment of your application. When you don't specify this, one of the following defaults is used: • If this is an instance that is part of an Auto Scaling group, it is set to ec2:name-of- Auto-Scaling-group • If this is an Amazon EC2 instance that is not part of an Auto Scaling group, it is set to ec2:default • If this is an on-premises host, it is set to generic:default This environment variable is used only by Application Signals, and is converted into X-Ray trace annotations and CloudWatch metric dimensions AWS Distro for OpenTelemetry 2069 Amazon CloudWatch User Guide 4. For the OTEL_EXPORTER_OTLP_TRACES_ENDPOINT variable, specify the X-Ray OTLP traces endpoint: https://xray.[AWSRegion].amazonaws.com/v1/traces. For example: export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://xray.us-west-2.amazonaws.com/ v1/traces" 5. For the JAVA_TOOL_OPTIONS variable, specify the path where the AWS Distro for OpenTelemetry Java auto-instrumentation agent is stored. export JAVA_TOOL_OPTIONS=" -javaagent:$AWS_ADOT_JAVA_INSTRUMENTATION_PATH" For example: export AWS_ADOT_JAVA_INSTRUMENTATION_PATH="./aws-opentelemetry-agent.jar" 6. 7. 8. 9. For the OTEL_METRICS_EXPORTER variable, it is recommended to set the value to none. For the OTEL_LOGS_EXPORTER variable, it is recommended to set the value to none. For the OTEL_TRACES_EXPORTER variable, you have to set the value for otlp (this is optional and is the default value if this environment variable is not set). For the OTEL_EXPORTER_OTLP_PROTOCOL variable, you have to set the value to http/ protobuf (this is optional and is the default value if this environment variable is not set). The X-Ray OTLP endpoint currently only supports the HTTP protocol. 10. Your application should now be running with AWS Distro for OpenTelemetry Java instrumentation and will generate spans. These spans are stored in the aws/spans CloudWatch LogsLogGroup in your account. You can also view the traces and metrics correlated with your spans in the CloudWatch Traces and Metrics Console. 11. Start your application with the environment variables you set. Here is an example of a starting script. (Note: The following configuration supports only versions 1.32.2 and later of the AWS Distro for OpenTelemetry auto-instrumentation agent for Java.) JAVA_TOOL_OPTIONS=" -javaagent:$AWS_ADOT_JAVA_INSTRUMENTATION_PATH" \ OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORTER=none \ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \ AWS Distro for OpenTelemetry 2070 Amazon CloudWatch User Guide OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://xray.us-east-1.amazonaws.com/v1/ traces \ OTEL_RESOURCE_ATTRIBUTES="service.name=$YOUR_SVC_NAME" \ java -jar $MY_JAVA_APP.jar Node.js 1. Download the latest version of the AWS Distro for OpenTelemetry JavaScript auto- instrumentation agent for Node.js. You can install using the command: npm install @aws/aws-distro-opentelemetry-node-autoinstrumentation To view information about all released versions, see AWS Distro for OpenTelemetry JavaScript instrumentation. 2. To enable the exporter that directly sends traces to the X-Ray OTLP endpoint and to optimize benefits, use the environment variables to provide additional information before you start your application. 3. For the OTEL_RESOURCE_ATTRIBUTES variable, specify the following information as key- value pairs: (Optional) service.name sets the name of the service. This will be displayed as the service name for your application in Application Signals dashboards. When you don't provide a value for this key, the default of UnknownService is used. (Optional) deployment.environment sets the environment that the application runs in. This will be diplayed as the Hosted In environment of your application in Application Signals dashboards. When you don't specify this variable, one of the following defaults is used: • If this is an instance that is part of an Auto Scaling group, it is set to ec2:name-of- Auto-Scaling-group • If this is an Amazon EC2 instance that is not part of an Auto Scaling group, it is set to ec2:default • If this is an on-premises host, it is set to generic:default AWS Distro for OpenTelemetry 2071 Amazon CloudWatch User Guide This environment variable is used only by
acw-ug-560
acw-ug.pdf
560
in. This will be diplayed as the Hosted In environment of your application in Application Signals dashboards. When you don't specify this variable, one of the following defaults is used: • If this is an instance that is part of an Auto Scaling group, it is set to ec2:name-of- Auto-Scaling-group • If this is an Amazon EC2 instance that is not part of an Auto Scaling group, it is set to ec2:default • If this is an on-premises host, it is set to generic:default AWS Distro for OpenTelemetry 2071 Amazon CloudWatch User Guide This environment variable is used only by Application Signals, and is converted into X-Ray trace annotations and CloudWatch metric dimensions. 4. For the OTEL_EXPORTER_OTLP_TRACES_ENDPOINT variable, specify the X-Ray OTLP traces endpoint: https://xray.[AWSRegion].amazonaws.com/v1/traces. For example: export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://xray.us-west-2.amazonaws.com/ v1/traces" 5. 6. 7. 8. For the OTEL_METRICS_EXPORTER variable, it is recommended to set the value to none. Application Signals metrics are generated by the OTLP endpoint. For the OTEL_LOGS_EXPORTER variable, it is recommended to set the value to none. For the OTEL_TRACES_EXPORTER variable, you have to set the value for otlp (this is optional and is the default value if this environment variable is not set). For the OTEL_EXPORTER_OTLP_PROTOCOL variable, you have to set the value to http/ protobuf (this is optional and is the default value if this environment variable is not set). The X-Ray OTLP endpoint currently only supports the HTTP protocol. 9. Your application should now be running with AWS Distro for OpenTelemetry Java instrumentation and will generate spans. These spans are stored in the aws/spans CloudWatch LogsLogGroup in your account. You can also view the traces and metrics correlated with your spans in the CloudWatch Traces and Metrics Console. 10. Start your application with the environment variables you set. Here is an example of a starting script. (Note: Replace $SVC_NAME with your application name. This is displayed as the name of the application. OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORTER=none \ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://xray.us-east-1.amazonaws.com/v1/ traces \ OTEL_RESOURCE_ATTRIBUTES="service.name=$SVC_NAME" \ node —require '@aws/aws-distro-opentelemetry-node-autoinstrumentation/register' your-application.js AWS Distro for OpenTelemetry 2072 Amazon CloudWatch Python User Guide 1. Download the latest version of the AWS Distro for OpenTelemetry Python auto- instrumentation agent. You can install using the command: pip install aws-opentelemetry-distro 2. To enable the exporter to directly send traces to the X-Ray OTLP endpoint and to optimize benefits, use the environment variables to provide additional information before you start your application. 3. For the OTEL_RESOURCE_ATTRIBUTES variable, specify the following information as key- value pairs: (Optional) service.name sets the name of the service. This will be displayed as the service name for your application in Application Signals dashboards. When you don't provide a value for this key, the default of UnknownService is used. (Optional) deployment.environment sets the environment that the application runs in. This will be diplayed as the Hosted In environment of your application in Application Signals dashboards. When you don't specify this, one of the following defaults is used: • If this is an instance that is part of an Auto Scaling group, it is set to ec2:name-of- Auto-Scaling-group • If this is an Amazon EC2 instance that is not part of an Auto Scaling group, it is set to ec2:default • If this is an on-premises host, it is set to generic:default This environment variable is used only by Application Signals, and is converted into X-Ray trace annotations and CloudWatch metric dimensions. 4. For the OTEL_EXPORTER_OTLP_TRACES_ENDPOINT variable, specify the X-Ray OTLP traces endpoint: https://xray.[AWSRegion].amazonaws.com/v1/traces. For example: export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://xray.us-west-2.amazonaws.com/ v1/traces" AWS Distro for OpenTelemetry 2073 Amazon CloudWatch User Guide 5. 6. 7. 8. For the OTEL_METRICS_EXPORTER variable, it is recommended to set the value to none. Application Signals metrics are generated by the OTLP endpoint. For the OTEL_LOGS_EXPORTER variable, it is recommended to set the value to none. For the OTEL_TRACES_EXPORTER variable, you have to set the value for otlp (this is optional and is the default value if this environment variable is not set). For the OTEL_EXPORTER_OTLP_PROTOCOL variable, you have to set the value to http/ protobuf (this is optional and is the default value if this environment variable is not set). The X-Ray OTLP endpoint currently only supports the HTTP protocol. 9. Your application should now be running with AWS Distro for OpenTelemetry Java instrumentation and will generate spans. These spans are stored in the aws/spans CloudWatch LogsLogGroup in your account. You can also view the traces and metrics correlated with your spans in the CloudWatch Traces and Metrics Console. 10. Start your application with the environment variables you set. Here is an example of a starting script. (Note: Replace $SVC_NAME with your application name and replace $PYTHON_APP with the location and name of your application. OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORTER=none \ OTEL_PYTHON_DISTRO=aws_distro \ OTEL_PYTHON_CONFIGURATOR=aws_configurator \ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://xray.us-east-1.amazonaws.com/v1/ traces \ OTEL_RESOURCE_ATTRIBUTES="service.name=$SVC_NAME" \ opentelemetry-instrument python $MY_PYTHON_APP.py .Net To enable the exporter that directly
acw-ug-561
acw-ug.pdf
561
for OpenTelemetry Java instrumentation and will generate spans. These spans are stored in the aws/spans CloudWatch LogsLogGroup in your account. You can also view the traces and metrics correlated with your spans in the CloudWatch Traces and Metrics Console. 10. Start your application with the environment variables you set. Here is an example of a starting script. (Note: Replace $SVC_NAME with your application name and replace $PYTHON_APP with the location and name of your application. OTEL_METRICS_EXPORTER=none \ OTEL_LOGS_EXPORTER=none \ OTEL_PYTHON_DISTRO=aws_distro \ OTEL_PYTHON_CONFIGURATOR=aws_configurator \ OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \ OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://xray.us-east-1.amazonaws.com/v1/ traces \ OTEL_RESOURCE_ATTRIBUTES="service.name=$SVC_NAME" \ opentelemetry-instrument python $MY_PYTHON_APP.py .Net To enable the exporter that directly sends traces to the X-Ray OTLP traces endpoint and to optimize benefits, set the environment variables to provide additional information before you start your application. These variables are also necessary to set up the .NET instrumentation. 1. Replace dotnet-service-name in the OTEL_RESOURCE_ATTRIBUTES environment variable with the service name of your choice. 2. Set OTEL_TRACES_EXPORTER=none. AWS Distro for OpenTelemetry 2074 Amazon CloudWatch User Guide 3. Set OTEL_AWS_SIG_V4_ENABLED=true. An example for Linux. export INSTALL_DIR=OpenTelemetryDistribution export CORECLR_ENABLE_PROFILING=1 export CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318} export CORECLR_PROFILER_PATH=${INSTALL_DIR}/linux-x64/ OpenTelemetry.AutoInstrumentation.Native.so export DOTNET_ADDITIONAL_DEPS=${INSTALL_DIR}/AdditionalDeps export DOTNET_SHARED_STORE=${INSTALL_DIR}/store export DOTNET_STARTUP_HOOKS=${INSTALL_DIR}/net/ OpenTelemetry.AutoInstrumentation.StartupHook.dll export OTEL_DOTNET_AUTO_HOME=${INSTALL_DIR} export OTEL_DOTNET_AUTO_PLUGINS="AWS.Distro.OpenTelemetry.AutoInstrumentation.Plugin, AWS.Distro.OpenTelemetry.AutoInstrumentation" export OTEL_TRACES_EXPORTER=none export OTEL_AWS_SIG_V4_ENABLED=true export OTEL_RESOURCE_ATTRIBUTES=service.name=dotnet-service-name export OTEL_METRICS_EXPORTER=none export OTEL_LOGS_EXPORTER=none export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://xray.us-east-1.amazonaws.com/ v1/traces An example for Windows Server. $env:INSTALL_DIR = "OpenTelemetryDistribution" $env:CORECLR_ENABLE_PROFILING = 1 $env:CORECLR_PROFILER = "{918728DD-259F-4A6A-AC2B-B85E1B658318}" $env:CORECLR_PROFILER_PATH = Join-Path $env:INSTALL_DIR "win-x64/ OpenTelemetry.AutoInstrumentation.Native.dll" $env:DOTNET_ADDITIONAL_DEPS = Join-Path $env:INSTALL_DIR "AdditionalDeps" $env:DOTNET_SHARED_STORE = Join-Path $env:INSTALL_DIR "store" $env:DOTNET_STARTUP_HOOKS = Join-Path $env:INSTALL_DIR "net/ OpenTelemetry.AutoInstrumentation.StartupHook.dll" $env:OTEL_DOTNET_AUTO_HOME = $env:INSTALL_DIR $env:OTEL_DOTNET_AUTO_PLUGINS = "AWS.Distro.OpenTelemetry.AutoInstrumentation.Plugin, AWS.Distro.OpenTelemetry.AutoInstrumentation" AWS Distro for OpenTelemetry 2075 Amazon CloudWatch User Guide $env:OTEL_TRACES_EXPORTER=none $env:OTEL_AWS_SIG_V4_ENABLED=true $env:OTEL_RESOURCE_ATTRIBUTES=service.name=dotnet-service-name $env:OTEL_METRICS_EXPORTER=none $env:OTEL_LOGS_EXPORTER=none $env:OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf $env:OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://xray.us-east-1.amazonaws.com/v1/ traces 4. 5. Start your application with the environment variables. (Optional) Alternatively, you can use the installation scripts provided to help installation and setup of AWS Distro for OpenTelemetry .NET auto-instrumentation package. For Linux, download and install the Bash installation script from the GitHub releases page: # Download and Install curl -L -O https://github.com/aws-observability/aws-otel-dotnet-instrumentation/ releases/latest/download/aws-otel-dotnet-install.sh chmod +x ./aws-otel-dotnet-install.sh ./aws-otel-dotnet-install.sh # Instrument . $HOME/.otel-dotnet-auto/instrument.shexport OTEL_RESOURCE_ATTRIBUTES=service.name=dotnet-service-name For Windows Server, download and install the PowerShell installation script from the GitHub releases page: # Download and Install $module_url = "https://github.com/aws-observability/aws-otel-dotnet- instrumentation/releases/latest/download/AWS.Otel.DotNet.Auto.psm1" $download_path = Join-Path $env:temp "AWS.Otel.DotNet.Auto.psm1" Invoke-WebRequest -Uri $module_url -OutFile $download_path Import-Module $download_path Install-OpenTelemetryCore # Instrument Import-Module $download_path Register-OpenTelemetryForCurrentSession -OTelServiceName "dotnet-service-name" Register-OpenTelemetryForIIS AWS Distro for OpenTelemetry 2076 Amazon CloudWatch User Guide You can find the NuGet package of the AWS Distro for OpenTelemetry .NET auto- instrumentation package in the official NuGet repository. Make sure to check the README file for instructions. Troubleshooting The following are the common troubleshooting scenarios and solutions for OTLP endpoint. Issue Description Solution Non-existing AWS credentials when launching OCB collector Collector throws the following error when starting. Enter the correct credentials. Error: invalid configura tion: extensions::sigv4auth: could not retrieve credentia l provider: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetada ta, request canceled, context deadline exceeded. Invalid AWS credentials Collector throws HTTP Status Code 403, Message=The Refresh the AWS credentials on the collector server. Transactions Search disabled security token included in the request is invalid., Details=[ ]“ when sending requests though OTLP endpoint. Collector throws Message=T he OTLP API is supported with CloudWatch Logs as a Trace Segment Destination. Make sure Transaction Search is enabled in CloudWatc h before using the OTLP endpoint for traces. For more information, see Transaction Search. Troubleshooting 2077 Amazon CloudWatch User Guide Issue Description Solution Batching and timeout issues Collector throws one of these issues: Tune batching and timeout policies using batchprocessor. • max elapsed time expired failed to make an HTTP request • io.opentelemetry.exporter.i nternal.http.HttpExporter - Failed to export spans. The request could not be executed. Full error message: timeout • io.opentelemetry.exporter.i nternal.grpc.GrpcExporter - Failed to export spans. Server responded with gRPC status code 2. Error message: timeout • rpc error: code = DeadlineE xceeded desc = context deadline exceeded • rpc error: code = ResourceE xhausted desc = Too many requests", "dropped_items": 1024 Troubleshooting 2078 Amazon CloudWatch Issue Retry issues User Guide Description Solution Transient network issues between the collector and Tune retry policy using exporter. OTLP endpoint. • rpc error: code = Unavailab le desc = error reading from server: read tcp • rpc error: code = Unavailab le desc = unexpected HTTP status code received from server: 502 (Bad Gateway); • rpc error: code = Unavailab le desc = unexpected HTTP status code received from server: 503 (Service Unavailable) Payload rejected NA Make sure the payload sent to the trace endpoint is within the limits and restrictions. For more information, see Endpoint limits and restricti ons. Troubleshooting 2079 Amazon CloudWatch User Guide Network Monitoring The topics in this section describe CloudWatch network and internet monitoring capabilities provided by Network Flow Monitor, Internet Monitor and Network Synthetic Monitor. These services help you to gain operational visibility into the network and internet
acw-ug-562
acw-ug.pdf
562
unexpected HTTP status code received from server: 502 (Bad Gateway); • rpc error: code = Unavailab le desc = unexpected HTTP status code received from server: 503 (Service Unavailable) Payload rejected NA Make sure the payload sent to the trace endpoint is within the limits and restrictions. For more information, see Endpoint limits and restricti ons. Troubleshooting 2079 Amazon CloudWatch User Guide Network Monitoring The topics in this section describe CloudWatch network and internet monitoring capabilities provided by Network Flow Monitor, Internet Monitor and Network Synthetic Monitor. These services help you to gain operational visibility into the network and internet performance and availability of your applications hosted on AWS. • Network Flow Monitor provides near real-time visibility into network performance, such as packet loss and latency, for traffic between Amazon EC2 instances, as well as traffic toward other AWS services, such as Amazon S3 and Amazon DynamoDB. Network Flow Monitor works by using data from lightweight software agents that you install to run on your instances. These fully-managed agents gather performance statistics from TCP connections and send them to the Network Flow Monitor backend. By creating monitors for specific agents and then using Network Flow Monitor dashboards, you can quickly visualize packet loss and latency of your network connections, and use attribution information to determine where to focus your troubleshooting efforts to improve your end users’ experience. • Internet Monitor uses the connectivity data that AWS captures from its global networking footprint to calculate a baseline of performance and availability for internet-facing traffic. You can see a global view of traffic patterns and health events, and easily drill down into information about events. You can also get alerts for internet health events that affect your application clients. In addition, you can use insights that Internet Monitor provides to explore potential improvements to your client experience, by using Amazon CloudFront or routing through different AWS Regions. • Network Synthetic Monitor uses fully-managed agents to enable you to track and visualize latency and packet loss for hybrid network connections. To gather measurements and enable Network Synthetic Monitor to create health event alerts for your application, you create probes that are sent from your resources hosted on AWS to on-premises destination IP addresses. You don't need to install additional agents to monitor your network performance. As with Internet Monitor, you can set alerts and thresholds, get information to help you quickly troubleshoot issues, and then take action to improve your end user experience. Topics • Using Network Flow Monitor • Using Internet Monitor • Using Network Synthetic Monitor 2080 Amazon CloudWatch User Guide Using Network Flow Monitor Network Flow Monitor provides near real-time visibility into network performance, such as packet loss and latency, for traffic between Amazon EC2 instances, as well as traffic toward other AWS services, such as Amazon S3 and Amazon DynamoDB. Network Flow Monitor receives data from lightweight software agents that you install on your instances. The agents gather performance statistics from TCP connections. This data is sent to the Network Flow Monitor backend service, and the top contributors for each metric type are calculated. Network Flow Monitor also determines if AWS is the cause of a detected network issue, and reports that information for network flows that you choose to monitor details for. You can view network performance information for network flows for resources in a single account, or you can configure Network Flow Monitor with AWS Organizations to view performance information for multiple accounts in an organization, by signing in with a management or delegated administrator account. Network Flow Monitor is intended for network operators and application developers who want near real-time insights into network performance. In the Network Flow Monitor console in CloudWatch, you can see performance data for your resources' network traffic that has been aggregated from agents and grouped into different categories. For example, you can see data for flows between Availability Zones or between VPCs. Then, you can create monitors for specific flows that you want to see more details for and track more closely over time. Using a monitor, you can quickly visualize packet loss and latency of your network connections over a time frame that you specify. For each monitor, Network Flow Monitor also generates a network health indicator (NHI). The NHI value informs you whether there were AWS network issues for the network flows tracked by your monitor during the time period that you're evaluating. Using the NHI information, you can quickly decide whether to focus troubleshooting efforts on an AWS network issue or network problems originating with your workloads. To see an example of configuring and using Network Flow Monitor, see the following blog post: Visualizing network performance of your AWS Cloud workloads with Network Flow Monitor. What is Network Flow Monitor? Network Flow Monitor is a feature of Amazon
acw-ug-563
acw-ug.pdf
563
Monitor also generates a network health indicator (NHI). The NHI value informs you whether there were AWS network issues for the network flows tracked by your monitor during the time period that you're evaluating. Using the NHI information, you can quickly decide whether to focus troubleshooting efforts on an AWS network issue or network problems originating with your workloads. To see an example of configuring and using Network Flow Monitor, see the following blog post: Visualizing network performance of your AWS Cloud workloads with Network Flow Monitor. What is Network Flow Monitor? Network Flow Monitor is a feature of Amazon CloudWatch Network Monitoring. Network Flow Monitor uses fully-managed agents that you install in your AWS workloads to return performance and availability metrics about network flows. Using Network Flow Monitor, you can access near Using Network Flow Monitor 2081 Amazon CloudWatch User Guide real-time metrics, including retransmissions and data transferred, for your actual workloads. You can also identify whether an underlying AWS network issue occurred for the network flows tracked by a monitor, by checking network health indicator (NHI) values. Key features of Network Flow Monitor • With Network Flow Monitor, you receive near real-time metrics for the latency and packet-loss experienced by TCP-based traffic within your VPC network, so that you can track and investigate network issues for your workload traffic. • When your AWS workloads experience network degradation, Network Flow Monitor helps you to determine if the problem is caused by your application workload or the underlying AWS infrastructure. Then, you can quickly focus troubleshooting on the area where the issue is occurring. How to use Network Flow Monitor With Network Flow Monitor, you install lightweight agents on your instances, which collect and aggregate performance metrics. Network Flow Monitor agents analyze TCP traffic, and then export performance metrics to the Network Flow Monitor service backend. Agents gather the following metrics for your workloads: TCP round-trip time (RTT), TCP retransmission timeouts, TCP retransmissions, and data (bytes) transferred. After you install agents on your instances, the agents detect the corresponding workloads that are hosted by the instances. The agents then generate network performance metrics and send the metrics to the Network Flow Monitor backend. Metrics are aggregated into categories such as subnets, Availability Zones, VPCs, and AWS services. Performance metrics for top contributors (by metric type) from all network flows that are in your Network Flow Monitor scope are shown on the Workload insights tab in the AWS Management Console. By reviewing the tables and graphs of top contributors, you can determine where there might be impairments that you want to troubleshoot and which workloads you want to monitor on an ongoing basis, by creating a monitor. With a monitor, you can monitor specific workloads more closely over time and see detailed information about specific network flows. In addition to viewing performance metrics for the top contributors for the network flows that you've selected, you can view topological information about the network hops that a network flow has traversed, to help you troubleshoot issues. In addition, Network Flow Monitor generates a network health indicator (NHI) for monitors. An NHI What is Network Flow Monitor? 2082 Amazon CloudWatch User Guide value of Degraded indicates that there were AWS network issues for at least one of the network flows tracked by your monitor, during the time period that you've selected. In addition to reviewing the information in monitors that you create, we recommend that you also check back regularly to review metrics on the Workload insights page, to see the latest top contributors for performance metrics for your network flows. As you review the latest information, consider if it would be helpful to add or remove workloads from your current monitors, or create new monitors. Contents • Supported AWS Regions for Network Flow Monitor • Components and features of Network Flow Monitor • How it works • Pricing for Network Flow Monitor Supported AWS Regions for Network Flow Monitor Network Flow Monitor is currently available in the following AWS Regions: Region name Asia Pacific (Mumbai) Asia Pacific (Osaka) Asia Pacific (Seoul) Asia Pacific (Singapore) Asia Pacific (Sydney) Asia Pacific (Tokyo) Canada (Central) Europe (Frankfurt) Europe (Ireland) Region ap-south-1 ap-northeast-3 ap-northeast-2 ap-southeast-1 ap-southeast-2 ap-northeast-1 ca-central-1 eu-central-1 eu-west-1 What is Network Flow Monitor? 2083 User Guide Amazon CloudWatch Region name Europe (London) Europe (Paris) Europe (Stockholm) South America (São Paulo) US East (N. Virginia) US East (Ohio) US West (N. California) US West (Oregon) Region eu-west-2 eu-west-3 eu-north-1 sa-east-1 us-east-1 us-east-2 us-west-1 us-west-2 Components and features of Network Flow Monitor Network Flow Monitor uses or references the following concepts. Agents An agent in Network Flow Monitor is a software application that you install on your Amazon EC2 instance resources. The application has two parts: • The first part receives events related to TCP connections and
acw-ug-564
acw-ug.pdf
564
ca-central-1 eu-central-1 eu-west-1 What is Network Flow Monitor? 2083 User Guide Amazon CloudWatch Region name Europe (London) Europe (Paris) Europe (Stockholm) South America (São Paulo) US East (N. Virginia) US East (Ohio) US West (N. California) US West (Oregon) Region eu-west-2 eu-west-3 eu-north-1 sa-east-1 us-east-1 us-east-2 us-west-1 us-west-2 Components and features of Network Flow Monitor Network Flow Monitor uses or references the following concepts. Agents An agent in Network Flow Monitor is a software application that you install on your Amazon EC2 instance resources. The application has two parts: • The first part receives events related to TCP connections and is registered within the Linux kernel using eBPF. eBPF is the Linux extended Berkley Packet Filter (eBPF) capability that allows a designated program to receive certain events raised by the Linux kernel. • The second part aggregates the statistics collected by the eBPF portion. The agent sends the aggregated metrics to the Network Flow Monitor backend about every 30 seconds, with a 5 second potential jitter (in other words, 25 to 35 seconds). For more information about agents, see How it works. Top contributors Top contributors are the network flows that have the highest values for a specific metric (such as retransmissions) in your Network Flow Monitor scope or among the network flows you're tracking in a monitor. Reviewing the flows with the highest reported numbers for performance What is Network Flow Monitor? 2084 Amazon CloudWatch User Guide metric measurements can help you see where there might be impairments to investigate. Network Flow Monitor returns performance metrics for top contributors in your monitoring scope for workload insights. In addition, if you create a monitor, Network Flow Monitor returns performance metrics for top contributors for the network flows that you choose for the monitor. Local and remote resources A local resource, in a bi-directional flow of a workload, is the host where the agent is installed. For example, if a workload consists of an interaction between a web service and a backend database (for example, Amazon RDS), the EC2 instance hosting the web service, which also runs the agent, is the local resource. A local resource can be a subnet, a VPC, or an Availability Zone. The local resource is identified by the IP address and the transport protocol port, at a minimum. A remote resource is the other endpoint in the bi-directional flow of a workload. In this example of a web service with a backend RDS database, Amazon RDS is the remote resource. A remote resource can be a subnet, a VPC, an Availability Zone, or an AWS service. Just like a local resource, a remote resource is identified by the IP address of the endpoint and the transport protocol port. Workload insights Workload insights includes the performance metrics returned for all the network flows in your scope. In the AWS Management Console, the Workload insights page provides performance data about workloads where you've installed Network Flow Monitor agents on workload instances. The Workload insights page provides a view into your applications that includes the amount of data transferred and several other metrics, grouped into categories of workloads. For example, you can see all the metrics for workloads with traffic between Availability Zones (AZs) or within an AZ. By using these insights, you can select workloads for which you want to create a monitor to see more details and to track network performance on an ongoing basis. Monitors You create a monitor so that you can monitor, on an ongoing basis, the network performance for one or several specific workloads, and see more detailed information about the network flows. For each monitor, Network Flow Monitor publishes end-to-end performance metrics, and a network health indicator (NHI), which you can use to help determine attribution for impairments. We recommend that you review information on the Workload insights page to see which network flows you want to focus on, and then create a monitor for those flows. Then, by regularly reviewing Workload insights, you can decide if you have the monitors that you need, or if creating new monitors would be helpful. What is Network Flow Monitor? 2085 Amazon CloudWatch Network health indicator (NHI) User Guide The network health indicator (NHI) is a binary value that informs you whether there were AWS network issues for one or more of the network flows tracked by a monitor, during a time period that you choose. When the NHI value is 1, or Degraded, there was an AWS network issue for at least one network flow. With the NHI indicator, you can quickly decide whether to focus troubleshooting efforts on an AWS network issue or network problems originating with your workloads. For more information about agents, see View Network Flow Monitor metrics in CloudWatch. Scope In Network Flow Monitor, the scope is the account or
acw-ug-565
acw-ug.pdf
565
a binary value that informs you whether there were AWS network issues for one or more of the network flows tracked by a monitor, during a time period that you choose. When the NHI value is 1, or Degraded, there was an AWS network issue for at least one network flow. With the NHI indicator, you can quickly decide whether to focus troubleshooting efforts on an AWS network issue or network problems originating with your workloads. For more information about agents, see View Network Flow Monitor metrics in CloudWatch. Scope In Network Flow Monitor, the scope is the account or accounts that you have observability for when you look at network performance indicators. If you sign in as a management account and configure AWS Organizations with CloudWatch, you can set your scope to more than one account in your organization (up to 100 accounts total). Otherwise, if you sign in with an AWS account that does not have management permissions in Organizations, or if you have not configured Organizations with CloudWatch, Network Flow Monitor sets your scope to the account that you're signed in with. Network Flow Monitor generates a unique scope ID for the scope. Queries for metrics data use the scope ID to determine the resources that the Network Flow Monitor generates metrics for. (You must install agents to gather and submit metrics data before you can view the performance metrics for an account with Network Flow Monitor.) Query ID Network Flow Monitor generates a unique query ID for each query that is created to retrieve performance metrics data, such as a query for top contributors for a monitor. By using a query ID with an API call in Network Flow Monitor, you can check the status of a query, stop a query, run the query again, or work with the query in other ways. Performance metrics Network Flow Monitor gathers and calculates end-to-end performance metrics, including TCP round-trip time (RTT), TCP retransmissions, TCP retransmission time outs, and bytes transferred for each flow that is in your Network Flow Monitor scope. The service aggregates these metrics and returns them to the service backend. You can view top contributors by metric type. When you see an anomaly in Network Flow Monitor, you can also check the network health indicator (NHI) to see if there is an underlying AWS network issue. What is Network Flow Monitor? 2086 Amazon CloudWatch User Guide Be aware that RTT data can be sparse because RTT is not always calculated. You can also use Amazon CloudWatch features to create dashboards, alarms, and notifications based on these metrics. For example, you can learn about setting up alarms with Network Flow Monitor metrics by reviewing the information in Create alarms with Network Flow Monitor. How it works This section provides information about how agents in Network Flow Monitor work. How Network Flow Monitor agents work Agents in Network Flow Monitor are installed on Amazon EC2 instances, where they gather performance metrics and send them to the Network Flow Monitor backend. Agents do not have access to the payload of your TCP connections. Agents receive only what is called the "bpf_sock_ops" structure from the Linux kernel. This structure provides the local and remote IP address and the source and destination TCP port, as well as counters and round-trip times. For list of the TCP statistics collected and published by the agent, see View Network Flow Monitor metrics in CloudWatch. The agent uses the Network Flow Monitor Publish API to send metrics to the Network Flow Monitor backend server. Pricing for Network Flow Monitor With Network Flow Monitor, there are no upfront costs or long-term commitments. Pricing for Network Flow Monitor has two components: resources monitored (agents installed and actively sending data) and CloudWatch metrics vended. Note that you are also charged standard CloudWatch prices for any additional metrics, dashboards, alarms, or insights that you create. For more information about Network Flow Monitor and Amazon CloudWatch pricing, see Network Monitoring on the Amazon CloudWatch pricing page. Get started with Network Flow Monitor To help you get started, the section provides a high level overview of the steps to configure, and then gain insights, with Network Flow Monitor. For details, see the additional sections in this guide about initializing Network Flow Monitor, configuring agents, and creating monitors. Get started 2087 Amazon CloudWatch User Guide • Initialize Network Flow Monitor, to accept service-linked role permissions, create a scope for monitoring in Network Flow Monitor, and create an initial topology. If you want to observe network performance for network flows for instances in multiple accounts, you must integrate with AWS Organizations, and then add the accounts to your scope. To learn more, see Initialize Network Flow Monitor. • Deploy agents on your instances, by using AWS Systems Manager or by configuring Kubernetes,
acw-ug-566
acw-ug.pdf
566
see the additional sections in this guide about initializing Network Flow Monitor, configuring agents, and creating monitors. Get started 2087 Amazon CloudWatch User Guide • Initialize Network Flow Monitor, to accept service-linked role permissions, create a scope for monitoring in Network Flow Monitor, and create an initial topology. If you want to observe network performance for network flows for instances in multiple accounts, you must integrate with AWS Organizations, and then add the accounts to your scope. To learn more, see Initialize Network Flow Monitor. • Deploy agents on your instances, by using AWS Systems Manager or by configuring Kubernetes, depending on how your resources are deployed. If you install agents on VPC EC2 instances, make sure that you enable permissions for agents on each instance to send metrics to the Network Flow Monitor backend. To learn more, see Install Network Flow Monitor agents on instances. • Review top contributor metrics for network flows returned by the agents, to gain workload insights. Workload insights provide a high-level view of the performance for network flows in the scope you're monitoring. • Based on the network flows that you want to see detailed network information about, create one or more monitors. Using a monitor, you can see details metrics and information, as well as view topologies for specific network flows, over time periods that you select. • On a regular basis: • Review network flow information in the monitors that you've created, to learn about and help troubleshoot network impairments in your workloads. • Review workload insights for the network flows that you're monitoring, to determine if the monitors that you've created are covering the most relevant network flows or if it would be helpful to create new monitors. Network Flow Monitor API operations The following table lists Network Flow Monitor API operations that you can use with Network Flow Monitor. The table also includes links to relevant documentation. Action API operation More information Create a flow monitor. See CreateMonitor See Create a monitor in Network Flow Monitor Generate metrics for a scope of resources. See CreateScope See Evaluate network flows with workload insights API operations 2088 Amazon CloudWatch User Guide Action API operation More information Remove a monitor. See DeleteMonitor Delete a defined scope. See DeleteScope Get information about a monitor. See GetMonitor Get query data for the top contributors in a specific See GetQueryResultsMon itorTopContributors monitor. See Delete a monitor in Network Flow Monitor See Delete a monitor in Network Flow Monitor See Monitor and analyze network flows using Network Flow Monitor performance metrics See Monitor and analyze network flows using Network Flow Monitor performance metrics Query the top contribut ors for a defined scope for See GetQueryResultsWor kloadInsightsTopContributors See Evaluate network flows with workload insights workload insights. Query workload insights data for the top contributors in a See GetQueryResultsWor kloadInsightsTopContributor See Evaluate network flows with workload insights specific scope. sData Check the status of a query for top contributors in a See GetQueryStatusMoni torTopContributors N/A monitor to ensure that it has succeeded before reviewing the results. Check the status of a query on workload insights for top contributors to ensure that it has succeeded before reviewing the results. See GetQueryStatusWork loadInsightsTopContributors N/A API operations 2089 Amazon CloudWatch User Guide Action API operation More information Check the status of a query on workload insights data for See GetQueryStatusWork loadInsightsTopContributors N/A top contributors to ensure Data that it has succeeded before reviewing the results. Get information about an account, or scope, including name, status, tags, and target details. See GetScope List all monitors in an account. See ListMonitors See Monitor and analyze network flows using Network Flow Monitor performance metrics Monitor and analyze network flows using Network Flow Monitor performance metrics List all scopes for an account. See ListScopes N/A List all tags for a specific resource. See ListTagsForResource See query data for top contributors in a monitor. See StartQueryMonitorT opContributors See Monitor and analyze network flows using Network Flow Monitor performance metrics See Monitor and analyze network flows using Network Flow Monitor performance metrics Start a query to gather workload insights data for top contributors. See StartQueryWorkload InsightsTopContributors See Evaluate network flows with workload insights Stop a query for top contribut ors in a monitor. See StopQueryMonitorTo pContributors Stop a query on workload insights data for top contribut See StopQueryWorkloadI nsightsTopContributors N/A N/A ors. API operations 2090 Amazon CloudWatch User Guide Action API operation More information Stop a query on workload insights data for top contribut See StopQueryWorkloadI nsightsTopContributorsData N/A ors. Add a tag to a resource. See TagResource See UntagResource See UpdateMonitor See Edit a monitor in Network Flow Monitor See Edit a monitor in Network Flow Monitor See Edit a monitor in Network Flow Monitor See UpdateScope N/A Remove a tag from a resource. Update a monitor to
acw-ug-567
acw-ug.pdf
567
contribut ors in a monitor. See StopQueryMonitorTo pContributors Stop a query on workload insights data for top contribut See StopQueryWorkloadI nsightsTopContributors N/A N/A ors. API operations 2090 Amazon CloudWatch User Guide Action API operation More information Stop a query on workload insights data for top contribut See StopQueryWorkloadI nsightsTopContributorsData N/A ors. Add a tag to a resource. See TagResource See UntagResource See UpdateMonitor See Edit a monitor in Network Flow Monitor See Edit a monitor in Network Flow Monitor See Edit a monitor in Network Flow Monitor See UpdateScope N/A Remove a tag from a resource. Update a monitor to add or remove local or remote resources. Modify a scope to add or remove resources that Network Flow Monitor will generate metrics on. Examples of using the CLI with Network Flow Monitor This section includes examples for using the AWS Command Line Interface with Network Flow Monitor operations. Before you begin, make sure that you log in to use the AWS CLI with the AWS account that provides the scope that you want to use to monitor network flows. For more information about using API actions with Network Flow Monitor, see the Network Flow Monitor API Reference Guide. Topics • Create a monitor • View monitor details • Create a scope • Delete a monitor • Delete a scope • Get information about a monitor Examples with the CLI 2091 Amazon CloudWatch User Guide • Retrieve data on a specific queries • See scope information • See a list of monitors for an account • See a list of scopes for an account • See the list of tags for a monitor • Starting and stopping queries • Tag a monitor • Remove a tag from a monitor • Update an existing monitor Create a monitor To create a monitor with the AWS CLI, use the create-monitor command. The following example creates a monitor named demo in the specified account. aws networkflowmonitor create-monitor \ --monitor-name demo \ --local-resources type="AWS::EC2::VPC",identifier="arn:aws:ec2:us- east-1:111122223333:vpc/vpc-11223344556677889" \ --scope-arn arn:aws:networkflowmonitor:us-east-1:111122223333:scope/sample- aaaa-bbbb-cccc-44556677889 Output: { "monitorArn": "arn:aws:networkflowmonitor:us-east-1:111122223333:monitor/demo", "monitorName": "demo", "monitorStatus": "ACTIVE", "tags": {} } For more information, see Create a monitor in Network Flow Monitor. View monitor details To view information about a monitor with the AWS CLI, use the get-monitor command. aws networkflowmonitor get-monitor --monitor-name "TestMonitor" Examples with the CLI 2092 Amazon CloudWatch Output: { User Guide "ClientLocationType": "city", "CreatedAt": "2022-09-22T19:27:47Z", "ModifiedAt": "2022-09-22T19:28:30Z", "MonitorArn": "arn:aws:networkflowmonitor:us-east-1:111122223333:monitor/ TestMonitor", "MonitorName": "TestMonitor", "ProcessingStatus": "OK", "ProcessingStatusInfo": "The monitor is actively processing data", "Resources": [ "arn:aws:ec2:us-east-1:111122223333:vpc/vpc-11223344556677889" ], "MaxCityNetworksToMonitor": 10000, "Status": "ACTIVE" } Create a scope The following create-scope example creates a scope that is the set of resources for which Network Flow Monitor will generate network traffic metrics. aws networkflowmonitor create-scope \ --targets '[{"targetIdentifier":{"targetId": {"accountId":"111122223333"},"targetType":"ACCOUNT"},"region":"us-east-1"}]' Output: { "scopeId": "sample-aaaa-bbbb-cccc-11112222333", "status": "IN_PROGRESS", "tags": {} } For more information, see Components and features of Network Flow Monitor. Delete a monitor The following delete-monitor example deletes a monitor named Demo in your account. Examples with the CLI 2093 Amazon CloudWatch User Guide aws networkflowmonitor delete-monitor \ --monitor-name Demo This command produces no output. For more information, see Delete a monitor in Network Flow Monitor. Delete a scope The following delete-scope example deletes the specified scope. aws networkflowmonitor delete-scope \ --scope-id sample-aaaa-bbbb-cccc-44556677889 This command produces no output. For more information, see Components and features of Network Flow Monitor. Get information about a monitor The following get-monitor example displays information about the monitor named demo in the specified account. aws networkflowmonitor get-monitor \ --monitor-name Demo Output: { "monitorArn": "arn:aws:networkflowmonitor:us-east-1:111122223333:monitor/Demo", "monitorName": "Demo", "monitorStatus": "ACTIVE", "localResources": [ { "type": "AWS::EC2::VPC", "identifier": "arn:aws:ec2:us-east-1:111122223333:vpc/ vpc-11223344556677889" } ], "remoteResources": [], "createdAt": "2024-12-09T12:21:51.616000-06:00", "modifiedAt": "2024-12-09T12:21:55.412000-06:00", Examples with the CLI 2094 Amazon CloudWatch "tags": {} } User Guide For more information, see Components and features of Network Flow Monitor. Retrieve data on a specific queries The following sections provide example CLI commands to retrieve query statuses. get-query-results-workload-insights-top-contributors-data The get-query-results-workload-insights-top-contributors-data example returns the data for the specified query. aws networkflowmonitor get-query-results-workload-insights-top-contributors-data \ --scope-id sample-aaaa-bbbb-cccc-11112222333 \ --query-id sample-dddd-eeee-ffff-44556677889 Output: { "datapoints": [ { "timestamps": [ "2024-12-09T19:00:00+00:00", "2024-12-09T19:05:00+00:00", "2024-12-09T19:10:00+00:00" ], "values": [ 259943.0, 194856.0, 216432.0 ], "label": "use1-az6" } ], "unit": "Bytes" } get-query-results-workload-insights-top-contributors The following get-query-results-workload-insights-top-contributors example returns the data for the specified query. Examples with the CLI 2095 Amazon CloudWatch User Guide aws networkflowmonitor get-query-results-workload-insights-top-contributors \ --scope-id sample-aaaa-bbbb-cccc-11112222333 \ --query-id sample-dddd-eeee-ffff-44556677889 Output: { "topContributors": [ { "accountId": "111122223333", "localSubnetId": "subnet-SAMPLE1111", "localAz": "use1-az6", "localVpcId": "vpc-SAMPLE2222", "localRegion": "us-east-1", "remoteIdentifier": "", "value": 333333, "localSubnetArn": "arn:aws:ec2:us-east-1:111122223333:subnet/ subnet-2222444455556666", "localVpcArn": "arn:aws:ec2:us-east-1:111122223333:vpc/ vpc-11223344556677889" } ] } get-query-status-monitor-top-contributors The following get-query-status-monitor-top-contributors example displays the current status of the query in the specified account. aws networkflowmonitor get-query-status-monitor-top-contributors \ --monitor-name Demo \ --query-id sample-dddd-eeee-ffff-44556677889 Output: { "status": "SUCCEEDED" } Examples with the CLI 2096 Amazon CloudWatch User Guide get-query-status-workload-insights-top-contributors-data The following get-query-status-workload-insights-top-contributors-data example displays the current status of the query in the specified account. aws networkflowmonitor get-query-status-workload-insights-top-contributors-data
acw-ug-568
acw-ug.pdf
568
2095 Amazon CloudWatch User Guide aws networkflowmonitor get-query-results-workload-insights-top-contributors \ --scope-id sample-aaaa-bbbb-cccc-11112222333 \ --query-id sample-dddd-eeee-ffff-44556677889 Output: { "topContributors": [ { "accountId": "111122223333", "localSubnetId": "subnet-SAMPLE1111", "localAz": "use1-az6", "localVpcId": "vpc-SAMPLE2222", "localRegion": "us-east-1", "remoteIdentifier": "", "value": 333333, "localSubnetArn": "arn:aws:ec2:us-east-1:111122223333:subnet/ subnet-2222444455556666", "localVpcArn": "arn:aws:ec2:us-east-1:111122223333:vpc/ vpc-11223344556677889" } ] } get-query-status-monitor-top-contributors The following get-query-status-monitor-top-contributors example displays the current status of the query in the specified account. aws networkflowmonitor get-query-status-monitor-top-contributors \ --monitor-name Demo \ --query-id sample-dddd-eeee-ffff-44556677889 Output: { "status": "SUCCEEDED" } Examples with the CLI 2096 Amazon CloudWatch User Guide get-query-status-workload-insights-top-contributors-data The following get-query-status-workload-insights-top-contributors-data example displays the current status of the query in the specified account. aws networkflowmonitor get-query-status-workload-insights-top-contributors-data \ --scope-id sample-aaaa-bbbb-cccc-11112222333 \ --query-id sample-dddd-eeee-ffff-44556677889 Output: { "status": "SUCCEEDED" } get-query-results-workload-insights-top-contributors The following get-query-results-workload-insights-top-contributors example displays the current status of the query in the specified account. aws networkflowmonitor get-query-status-workload-insights-top-contributors \ --scope-id sample-aaaa-bbbb-cccc-11112222333 \ --query-id sample-dddd-eeee-ffff-44556677889 Output: { "status": "SUCCEEDED" } For more information, see Evaluate network flows with workload insights. See scope information The following get-scope example displays information about a scope, such as status, tags, name, and target details. aws networkflowmonitor get-scope \ --scope-id sample-aaaa-bbbb-cccc-11112222333 Examples with the CLI 2097 Amazon CloudWatch Output: { User Guide "scopeId": "sample-aaaa-bbbb-cccc-11112222333", "status": "SUCCEEDED", "scopeArn": "arn:aws:networkflowmonitor:us-east-1:111122223333:scope/sample- aaaa-bbbb-cccc-11112222333", "targets": [ { "targetIdentifier": { "targetId": { "accountId": "111122223333" }, "targetType": "ACCOUNT" }, "region": "us-east-1" } ], "tags": {} } For more information, see Components and features of Network Flow Monitor. See a list of monitors for an account The following list-monitors example returns all the monitors in the specified account. aws networkflowmonitor list-monitors Output: { "monitors": [ { "monitorArn": "arn:aws:networkflowmonitor:us- east-1:111122223333:monitor/Demo", "monitorName": "Demo", "monitorStatus": "ACTIVE" } ] } Examples with the CLI 2098 Amazon CloudWatch User Guide For more information, see Components and features of Network Flow Monitor. See a list of scopes for an account The following list-scopes example lists all the scopes in the specified account. aws networkflowmonitor list-scopes Output: { "scopes": [ { "scopeId": "sample-aaaa-bbbb-cccc-11112222333", "status": "SUCCEEDED", "scopeArn": "arn:aws:networkflowmonitor:us-east-1:111122223333:scope/ sample-aaaa-bbbb-cccc-11112222333" } ] } For more information, see Components and features of Network Flow Monitor. See the list of tags for a monitor The following list-tags-for-resource example returns all the tags associated with the specified resource. aws networkflowmonitor list-tags-for-resource \ --resource-arn arn:aws:networkflowmonitor:us-east-1:111122223333:monitor/Demo Output: { "tags": { "Value": "Production", "Key": "stack" } } For more information, see Tagging your Amazon CloudWatch resources. Examples with the CLI 2099 Amazon CloudWatch User Guide Starting and stopping queries The following sections provide example CLI commands for starting and stopping queries in Network Flow Monitor. start-query-monitor-top-contributors The following start-query-monitor-top-contributors example starts the query which returns a queryId to retrieve the top contributors. aws networkflowmonitor start-query-monitor-top-contributors \ --monitor-name Demo \ --start-time 2024-12-09T19:00:00Z \ --end-time 2024-12-09T19:15:00Z \ --metric-name DATA_TRANSFERRED \ --destination-category UNCLASSIFIED Output: { "queryId": "sample-dddd-eeee-ffff-44556677889" } For more information, see Evaluate network flows with workload insights. start-query-workload-insights-top-contributors-data The following start-query-workload-insights-top-contributors-data example starts the query which returns a queryId to retrieve the top contributors. aws networkflowmonitor start-query-workload-insights-top-contributors-data \ --scope-id sample-aaaa-bbbb-cccc-11112222333 \ --start-time 2024-12-09T19:00:00Z \ --end-time 2024-12-09T19:15:00Z \ --metric-name DATA_TRANSFERRED \ --destination-category UNCLASSIFIED Output: { "queryId": "sample-dddd-eeee-ffff-44556677889" Examples with the CLI 2100 Amazon CloudWatch } User Guide For more information, see Evaluate network flows with workload insights. start-query-workload-insights-top-contributors The following start-query-workload-insights-top-contributors example starts the query which returns a queryId to retrieve the top contributors. aws networkflowmonitor start-query-workload-insights-top-contributors \ --scope-id sample-aaaa-bbbb-cccc-11112222333 \ --start-time 2024-12-09T19:00:00Z \ --end-time 2024-12-09T19:15:00Z \ --metric-name DATA_TRANSFERRED \ --destination-category UNCLASSIFIED Output: { "queryId": "sample-dddd-eeee-ffff-44556677889" } For more information, see Evaluate network flows with workload insights. stop-query-monitor-top-contributors The following stop-query-monitor-top-contributors example stops the query in the specified account. aws networkflowmonitor stop-query-monitor-top-contributors \ --monitor-name Demo \ --query-id sample-dddd-eeee-ffff-44556677889 This command produces no output. For more information, see Evaluate network flows with workload insights. stop-query-workload-insights-top-contributors-data The following stop-query-workload-insights-top-contributors-data stops the query in the specified account. Examples with the CLI 2101 Amazon CloudWatch User Guide aws networkflowmonitor stop-query-workload-insights-top-contributors-data \ --scope-id sample-aaaa-bbbb-cccc-11112222333 \ --query-id sample-dddd-eeee-ffff-44556677889 This command produces no output. For more information, see Evaluate network flows with workload insights. stop-query-workload-insights-top-contributors The following stop-query-workload-insights-top-contributors example stops the query in the specified account. aws networkflowmonitor stop-query-workload-insights-top-contributors \ --scope-id sample-aaaa-bbbb-cccc-11112222333 \ --query-id sample-dddd-eeee-ffff-44556677889 This command produces no output. For more information, see Evaluate network flows with workload insights. Tag a monitor The following tag-resource adds a tag to the monitor in the specified account. aws networkflowmonitor tag-resource \ --resource-arn arn:aws:networkflowmonitor:us-east-1:111122223333:monitor/Demo \ --tags Key=stack,Value=Production This command produces no output. For more information, see Tagging your Amazon CloudWatch resources. Remove a tag from a monitor The following untag-resource example removes a tag to the monitor in the specified account. aws networkflowmonitor untag-resource \ --resource-arn arn:aws:networkflowmonitor:us-east-1:111122223333:monitor/Demo \ Examples with the CLI 2102 Amazon CloudWatch --tag-keys stack This command produces no output. User Guide For more information, see Tagging your Amazon CloudWatch resources. Update an existing monitor The following update-monitor example updates the monitor named ``Demo`` in the specified account. aws networkflowmonitor update-monitor \ --monitor-name Demo \ --local-resources-to-add type="AWS::EC2::VPC",identifier="arn:aws:ec2:us-
acw-ug-569
acw-ug.pdf
569
networkflowmonitor tag-resource \ --resource-arn arn:aws:networkflowmonitor:us-east-1:111122223333:monitor/Demo \ --tags Key=stack,Value=Production This command produces no output. For more information, see Tagging your Amazon CloudWatch resources. Remove a tag from a monitor The following untag-resource example removes a tag to the monitor in the specified account. aws networkflowmonitor untag-resource \ --resource-arn arn:aws:networkflowmonitor:us-east-1:111122223333:monitor/Demo \ Examples with the CLI 2102 Amazon CloudWatch --tag-keys stack This command produces no output. User Guide For more information, see Tagging your Amazon CloudWatch resources. Update an existing monitor The following update-monitor example updates the monitor named ``Demo`` in the specified account. aws networkflowmonitor update-monitor \ --monitor-name Demo \ --local-resources-to-add type="AWS::EC2::VPC",identifier="arn:aws:ec2:us- east-1:111122223333:vpc/vpc-11223344556677889" Output: { "monitorArn": "arn:aws:networkflowmonitor:us-east-1:111122223333:monitor/Demo", "monitorName": "Demo", "monitorStatus": "ACTIVE", "tags": { "Value": "Production", "Key": "stack" } } For more information, see Components and features of Network Flow Monitor. Install Network Flow Monitor agents on instances To provide performance metrics for network flows in your AWS workloads, Network Flow Monitor relies on agents that you install, which send the metrics to Network Flow Monitor. You install Network Flow Monitor agents on your instances, and then set the correct permissions for the agents so that they can send metrics to the Network Flow Monitor backend. An agent is a lightweight software application that you install on your resources, such as your VPC EC2 instances. Agents send performance metrics to the Network Flow Monitor backend on an ongoing basis. Then, you can view the metrics on the Workload insights page in the Network Flow Install agents 2103 Amazon CloudWatch User Guide Monitor console. You can also track detailed metrics for a specific network flow, or set of flows, by creating a monitor. The instances that you install agents on must be running supported versions and distributions of Linux. Network Flow Monitor supports agents to run only on Linux, and the Linux kernel version must be 5.8 or later. The following Linux distributions are supported. Note that agents are tested to run on the latest versions of these distributions. • Amazon Linux • Ubuntu • Red Hat • Suse Linux • Debian distributions for both x86 and aarch64 You can establish a private connection between your VPC and Network Flow Monitor agents by using AWS PrivateLink. For more information, see Using CloudWatch, CloudWatch Synthetics, and CloudWatch Network Monitoring with interface VPC endpoints. The steps that you follow to deploy agents in your instances depend on the type of instance: VPC EC2 instances, Amazon EKS Kubernetes instances, or self-managed (non-EKS) Kubernetes instances. Contents • Install and manage agents for EC2 instances • Install agents for self-managed Kubernetes instances • Install the EKS AWS Network Flow Monitor Agent add-on Install and manage agents for EC2 instances Follow the steps in this section to install Network Flow Monitor agents for workloads on Amazon EC2 instances. You can install agents by using SSM or by downloading and installing prebuilt packages for the Network Flow Monitor agent by using the command line. Regardless of the method that you use to install agents on EC2 instances, you must configure permissions for the agents to enable them to send performance metrics to the Network Flow Monitor backend. Install agents 2104 Amazon CloudWatch Contents • Configure permissions for agents • Install agents on EC2 instances with SSM User Guide • Download prebuilt packages of the Network Flow Monitor agent by using the command line Configure permissions for agents To enable agents to send metrics to the Network Flow Monitor ingestion backend, the EC2 instances that the agents run in must use a role that has a policy attached with the correct permissions. To provide the required permissions, use a role that has the following AWS managed policy attached: CloudWatchNetworkFlowMonitorAgentPublishPolicy. Attach this policy to the IAM roles of the EC2 instances where you plan to install Network Flow Monitor agents. We recommend that you add the permissions before you install agents on the EC2 instances. You can choose to wait until after you install agents, but the agents won't be able to send metrics to the service until the permissions are in place. To add permissions for Network Flow Monitor agents 1. In the AWS Management Console, in the Amazon EC2 console, locate the EC2 instances that you plan to install Network Flow Monitor agents on. 2. Attach the CloudWatchNetworkFlowMonitorAgentPublishPolicy to the IAM role for each instance. If an instance doesn't have an IAM role attached, choose a role by doing the following: 1. Under Actions, choose Security. 2. Choose Modify IAM role, or create a new role by choosing Create new IAM role. 3. Choose a role for the instance, and attach the CloudWatchNetworkFlowMonitorAgentPublishPolicy policy. Install agents on EC2 instances with SSM Network Flow Monitor agents provide performance metrics about network flows. Follow the steps in this section to install and work with Network Flow Monitor agents on EC2 instances, by using
acw-ug-570
acw-ug.pdf
570
Monitor agents on. 2. Attach the CloudWatchNetworkFlowMonitorAgentPublishPolicy to the IAM role for each instance. If an instance doesn't have an IAM role attached, choose a role by doing the following: 1. Under Actions, choose Security. 2. Choose Modify IAM role, or create a new role by choosing Create new IAM role. 3. Choose a role for the instance, and attach the CloudWatchNetworkFlowMonitorAgentPublishPolicy policy. Install agents on EC2 instances with SSM Network Flow Monitor agents provide performance metrics about network flows. Follow the steps in this section to install and work with Network Flow Monitor agents on EC2 instances, by using AWS Systems Manager. If you use Kubernetes, skip to the next sections for information about installing agents with Amazon EKS clusters or self-managed Kubernetes clusters. Install agents 2105 Amazon CloudWatch User Guide Network Flow Monitor provides a Distributor package for you in Systems Manager to use to install or uninstall agents. In addition, Network Flow Monitor provides a document to activate or deactivate agents, by using the Document Type command. Use standard Systems Manager procedures to use the package and the document, or follow the steps provided here for detailed guidance. For more information in general about using Systems Manager, see the following documentation: • AWS Systems Manager Run Command • AWS Systems Manager Distributor Complete the steps in the following sections to configure permissions, install, and work with Network Flow Monitor agents. Contents • Install or uninstall agents • Activate or deactivate agents Install or uninstall agents by using Systems Manager Network Flow Monitor provides a distributor package in AWS Systems Manager for you to install Network Flow Monitor agents: AmazonCloudWatchNetworkFlowMonitorAgent. To access and run the package to install agents, follow the steps provided here. To install agents in EC2 instances 1. In the AWS Management Console, in AWS Systems Manager, under Node Tools, choose Distributor. 2. Under Owned by Amazon, locate the Network Flow Monitor package, AmazonCloudWatchNetworkFlowMonitorAgent, and select it. 3. 4. 5. 6. In the Run command flow, choose Install one time or Install on schedule. In the Target selection section, choose how you want to select your EC2 instances to install agents on. You can select instances based on tags, choose instances manually, or base the choice on resource groups. In the Commmand parameters section, under Action, choose Install. Scroll down, if necessary, and then choose Run to start the installation. Install agents 2106 Amazon CloudWatch User Guide If the installation is successful and the instances have permissions to access Network Flow Monitor endpoints, the agent will start collecting metrics and send reports to the Network Flow Monitor backend. Agents that are active (sending metrics data) incur billing costs. For more information about Network Flow Monitor and Amazon CloudWatch pricing, see Network Monitoring on the Amazon CloudWatch pricing page. If you don't need metrics data temporarily, you can deactivate an agent. For more information, see Activate or deactivate agents. If you no longer need Network Flow Monitor agents, you can uninstall them from the EC2 instances. To uninstall agents from EC2 instances 1. In the AWS Management Console, in AWS Systems Manager, under Node Tools, choose Distributor. 2. Under Owned by Amazon, locate the Network Flow Monitor package, AmazonCloudWatchNetworkFlowMonitorAgent, and select it. 3. 4. 5. In the Commmand parameters section, under Action, choose Uninstall. Select the EC2 instances to uninstall agents from. Scroll down, if necessary, and then choose Run to start the installation. Activate or deactivate agents by using Systems Manager After you install a Network Flow Monitor agent with SSM, you must activate it to receive network flow metrics from the instance where it's installed. Agents that are active (sending metrics data) incur billing costs. For more information about Network Flow Monitor and Amazon CloudWatch pricing, see Network Monitoring on the Amazon CloudWatch pricing page. If you don't need metrics data temporarily, you can deactivate an agent to prevent ongoing billing for the agent. Network Flow Monitor provides a document in AWS Systems Manager that you can use activate or deactivate agents that you've installed on your EC2 instances. By running this document to manage the agents, you can activate them to begin receiving performance metrics. Or, you can deactivate them to temporarily stop metrics from being sent,without uninstalling the agents. The document in SSM that you can use to activate or deactivate agents is called AmazonCloudWatch-NetworkFlowMonitorManageAgent. To access and run the document, follow the steps in the procedure. Install agents 2107 Amazon CloudWatch User Guide To activate or deactivate Network Flow Monitor agents 1. In the AWS Management Console, in AWS Systems Manager, under Change Management Tools, choose Documents. 2. Under Owned by Amazon, locate the Network Flow Monitor document, AmazonCloudWatch- NetworkFlowMonitorManageAgent, and select the document. 3. 4. In the Target selection section, choose how you want to select your EC2 instances to