Class: AWS.Synthetics

Inherits:
AWS.Service show all
Identifier:
synthetics
API Version:
2017-10-11
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

You can use Amazon CloudWatch Synthetics to continually monitor your services. You can create and manage canaries, which are modular, lightweight scripts that monitor your endpoints and APIs from the outside-in. You can set up your canaries to run 24 hours a day, once per minute. The canaries help you check the availability and latency of your web services and troubleshoot anomalies by investigating load time data, screenshots of the UI, logs, and metrics. The canaries seamlessly integrate with CloudWatch ServiceLens to help you trace the causes of impacted nodes in your applications. For more information, see Using ServiceLens to Monitor the Health of Your Applications in the Amazon CloudWatch User Guide.

Before you create and manage canaries, be aware of the security considerations. For more information, see Security Considerations for Synthetics Canaries.

Sending a Request Using Synthetics

var synthetics = new AWS.Synthetics();
synthetics.createCanary(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the Synthetics object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var synthetics = new AWS.Synthetics({apiVersion: '2017-10-11'});

You can also set the API version globally in AWS.config.apiVersions using the synthetics service identifier:

AWS.config.apiVersions = {
  synthetics: '2017-10-11',
  // other service API versions
};

var synthetics = new AWS.Synthetics();

Version:

  • 2017-10-11

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.Synthetics(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a Synthetics object

var synthetics = new AWS.Synthetics({apiVersion: '2017-10-11'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String|AWS.Endpoint)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com' or an Endpoint object.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.Synthetics.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.Synthetics.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.Synthetics.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • s3UsEast1RegionalEndpoint ('legacy'|'regional')

    when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to legacy

  • s3UseArnRegion (Boolean)

    whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets Defaults to true

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds. If the result is a non-zero negative value, no further retry attempts will be made. The base option will be ignored if this option is supplied. The function is only called for retryable errors.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean|undefined)

    whether to call operations with endpoints given by service dynamically. Setting this

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

  • stsRegionalEndpoints ('legacy'|'regional')

    whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

createCanary(params = {}, callback) ⇒ AWS.Request

Creates a canary. Canaries are scripts that monitor your endpoints and APIs from the outside-in. Canaries help you check the availability and latency of your web services and troubleshoot anomalies by investigating load time data, screenshots of the UI, logs, and metrics. You can set up a canary to run continuously or just once.

Do not use CreateCanary to modify an existing canary. Use UpdateCanary instead.

To create canaries, you must have the CloudWatchSyntheticsFullAccess policy. If you are creating a new IAM role for the canary, you also need the the iam:CreateRole, iam:CreatePolicy and iam:AttachRolePolicy permissions. For more information, see Necessary Roles and Permissions.

Do not include secrets or proprietary information in your canary names. The canary name makes up part of the Amazon Resource Name (ARN) for the canary, and the ARN is included in outbound calls over the internet. For more information, see Security Considerations for Synthetics Canaries.

Service Reference:

Examples:

Calling the createCanary operation

var params = {
  ArtifactS3Location: 'STRING_VALUE', /* required */
  Code: { /* required */
    Handler: 'STRING_VALUE', /* required */
    S3Bucket: 'STRING_VALUE',
    S3Key: 'STRING_VALUE',
    S3Version: 'STRING_VALUE',
    ZipFile: Buffer.from('...') || 'STRING_VALUE' /* Strings will be Base-64 encoded on your behalf */
  },
  ExecutionRoleArn: 'STRING_VALUE', /* required */
  Name: 'STRING_VALUE', /* required */
  RuntimeVersion: 'STRING_VALUE', /* required */
  Schedule: { /* required */
    Expression: 'STRING_VALUE', /* required */
    DurationInSeconds: 'NUMBER_VALUE'
  },
  FailureRetentionPeriodInDays: 'NUMBER_VALUE',
  RunConfig: {
    ActiveTracing: true || false,
    EnvironmentVariables: {
      '<EnvironmentVariableName>': 'STRING_VALUE',
      /* '<EnvironmentVariableName>': ... */
    },
    MemoryInMB: 'NUMBER_VALUE',
    TimeoutInSeconds: 'NUMBER_VALUE'
  },
  SuccessRetentionPeriodInDays: 'NUMBER_VALUE',
  Tags: {
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  },
  VpcConfig: {
    SecurityGroupIds: [
      'STRING_VALUE',
      /* more items */
    ],
    SubnetIds: [
      'STRING_VALUE',
      /* more items */
    ]
  }
};
synthetics.createCanary(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      The name for this canary. Be sure to give it a descriptive name that distinguishes it from other canaries in your account.

      Do not include secrets or proprietary information in your canary names. The canary name makes up part of the canary ARN, and the ARN is included in outbound calls over the internet. For more information, see Security Considerations for Synthetics Canaries.

    • Code — (map)

      A structure that includes the entry point from which the canary should start running your script. If the script is stored in an S3 bucket, the bucket name, key, and version are also included.

      • S3Bucket — (String)

        If your canary script is located in S3, specify the full bucket name here. The bucket must already exist. Specify the full bucket name, including s3:// as the start of the bucket name.

      • S3Key — (String)

        The S3 key of your script. For more information, see Working with Amazon S3 Objects.

      • S3Version — (String)

        The S3 version ID of your script.

      • ZipFile — (Buffer, Typed Array, Blob, String)

        If you input your canary script directly into the canary instead of referring to an S3 location, the value of this parameter is the .zip file that contains the script. It can be up to 5 MB.

      • Handlerrequired — (String)

        The entry point to use for the source code when running the canary. This value must end with the string .handler.

    • ArtifactS3Location — (String)

      The location in Amazon S3 where Synthetics stores artifacts from the test runs of this canary. Artifacts include the log file, screenshots, and HAR files.

    • ExecutionRoleArn — (String)

      The ARN of the IAM role to be used to run the canary. This role must already exist, and must include lambda.amazonaws.com as a principal in the trust policy. The role must also have the following permissions:

      • s3:PutObject

      • s3:GetBucketLocation

      • s3:ListAllMyBuckets

      • cloudwatch:PutMetricData

      • logs:CreateLogGroup

      • logs:CreateLogStream

      • logs:PutLogEvents

    • Schedule — (map)

      A structure that contains information about how often the canary is to run and when these test runs are to stop.

      • Expressionrequired — (String)

        A rate expression that defines how often the canary is to run. The syntax is rate(number unit). unit can be minute, minutes, or hour.

        For example, rate(1 minute) runs the canary once a minute, rate(10 minutes) runs it once every 10 minutes, and rate(1 hour) runs it once every hour. You can specify a frequency between rate(1 minute) and rate(1 hour).

        Specifying rate(0 minute) or rate(0 hour) is a special value that causes the canary to run only once when it is started.

      • DurationInSeconds — (Integer)

        How long, in seconds, for the canary to continue making regular runs according to the schedule in the Expression value. If you specify 0, the canary continues making runs until you stop it. If you omit this field, the default of 0 is used.

    • RunConfig — (map)

      A structure that contains the configuration for individual canary runs, such as timeout value.

      • TimeoutInSeconds — (Integer)

        How long the canary is allowed to run before it must stop. You can't set this time to be longer than the frequency of the runs of this canary.

        If you omit this field, the frequency of the canary is used as this value, up to a maximum of 14 minutes.

      • MemoryInMB — (Integer)

        The maximum amount of memory available to the canary while it is running, in MB. This value must be a multiple of 64.

      • ActiveTracing — (Boolean)

        Specifies whether this canary is to use active AWS X-Ray tracing when it runs. Active tracing enables this canary run to be displayed in the ServiceLens and X-Ray service maps even if the canary does not hit an endpoint that has X-ray tracing enabled. Using X-Ray tracing incurs charges. For more information, see Canaries and X-Ray tracing.

        You can enable active tracing only for canaries that use version syn-nodejs-2.0 or later for their canary runtime.

      • EnvironmentVariables — (map<String>)

        Specifies the keys and values to use for any environment variables used in the canary script. Use the following format:

        { "key1" : "value1", "key2" : "value2", ...}

        Keys must start with a letter and be at least two characters. The total size of your environment variables cannot exceed 4 KB. You can't specify any Lambda reserved environment variables as the keys for your environment variables. For more information about reserved keys, see Runtime environment variables.

    • SuccessRetentionPeriodInDays — (Integer)

      The number of days to retain data about successful runs of this canary. If you omit this field, the default of 31 days is used. The valid range is 1 to 455 days.

    • FailureRetentionPeriodInDays — (Integer)

      The number of days to retain data about failed runs of this canary. If you omit this field, the default of 31 days is used. The valid range is 1 to 455 days.

    • RuntimeVersion — (String)

      Specifies the runtime version to use for the canary. For a list of valid runtime versions and more information about runtime versions, see Canary Runtime Versions.

    • VpcConfig — (map)

      If this canary is to test an endpoint in a VPC, this structure contains information about the subnet and security groups of the VPC endpoint. For more information, see Running a Canary in a VPC.

      • SubnetIds — (Array<String>)

        The IDs of the subnets where this canary is to run.

      • SecurityGroupIds — (Array<String>)

        The IDs of the security groups for this canary.

    • Tags — (map<String>)

      A list of key-value pairs to associate with the canary. You can associate as many as 50 tags with a canary.

      Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only the resources that have certain tag values.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Canary — (map)

        The full details about the canary you have created.

        • Id — (String)

          The unique ID of this canary.

        • Name — (String)

          The name of the canary.

        • Code — (map)

          This structure contains information about the canary's Lambda handler and where its code is stored by CloudWatch Synthetics.

          • SourceLocationArn — (String)

            The ARN of the Lambda layer where Synthetics stores the canary script code.

          • Handler — (String)

            The entry point to use for the source code when running the canary.

        • ExecutionRoleArn — (String)

          The ARN of the IAM role used to run the canary. This role must include lambda.amazonaws.com as a principal in the trust policy.

        • Schedule — (map)

          A structure that contains information about how often the canary is to run, and when these runs are to stop.

          • Expression — (String)

            A rate expression that defines how often the canary is to run. The syntax is rate(number unit). unit can be minute, minutes, or hour.

            For example, rate(1 minute) runs the canary once a minute, rate(10 minutes) runs it once every 10 minutes, and rate(1 hour) runs it once every hour.

            Specifying rate(0 minute) or rate(0 hour) is a special value that causes the canary to run only once when it is started.

          • DurationInSeconds — (Integer)

            How long, in seconds, for the canary to continue making regular runs after it was created. The runs are performed according to the schedule in the Expression value.

        • RunConfig — (map)

          A structure that contains information about a canary run.

          • TimeoutInSeconds — (Integer)

            How long the canary is allowed to run before it must stop.

          • MemoryInMB — (Integer)

            The maximum amount of memory available to the canary while it is running, in MB. This value must be a multiple of 64.

          • ActiveTracing — (Boolean)

            Displays whether this canary run used active AWS X-Ray tracing.

        • SuccessRetentionPeriodInDays — (Integer)

          The number of days to retain data about successful runs of this canary.

        • FailureRetentionPeriodInDays — (Integer)

          The number of days to retain data about failed runs of this canary.

        • Status — (map)

          A structure that contains information about the canary's status.

          • State — (String)

            The current state of the canary.

            Possible values include:
            • "CREATING"
            • "READY"
            • "STARTING"
            • "RUNNING"
            • "UPDATING"
            • "STOPPING"
            • "STOPPED"
            • "ERROR"
            • "DELETING"
          • StateReason — (String)

            If the canary has insufficient permissions to run, this field provides more details.

          • StateReasonCode — (String)

            If the canary cannot run or has failed, this field displays the reason.

            Possible values include:
            • "INVALID_PERMISSIONS"
        • Timeline — (map)

          A structure that contains information about when the canary was created, modified, and most recently run.

          • Created — (Date)

            The date and time the canary was created.

          • LastModified — (Date)

            The date and time the canary was most recently modified.

          • LastStarted — (Date)

            The date and time that the canary's most recent run started.

          • LastStopped — (Date)

            The date and time that the canary's most recent run ended.

        • ArtifactS3Location — (String)

          The location in Amazon S3 where Synthetics stores artifacts from the runs of this canary. Artifacts include the log file, screenshots, and HAR files.

        • EngineArn — (String)

          The ARN of the Lambda function that is used as your canary's engine. For more information about Lambda ARN format, see Resources and Conditions for Lambda Actions.

        • RuntimeVersion — (String)

          Specifies the runtime version to use for the canary. For more information about runtime versions, see Canary Runtime Versions.

        • VpcConfig — (map)

          If this canary is to test an endpoint in a VPC, this structure contains information about the subnets and security groups of the VPC endpoint. For more information, see Running a Canary in a VPC.

          • VpcId — (String)

            The IDs of the VPC where this canary is to run.

          • SubnetIds — (Array<String>)

            The IDs of the subnets where this canary is to run.

          • SecurityGroupIds — (Array<String>)

            The IDs of the security groups for this canary.

        • Tags — (map<String>)

          The list of key-value pairs that are associated with the canary.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

deleteCanary(params = {}, callback) ⇒ AWS.Request

Permanently deletes the specified canary.

When you delete a canary, resources used and created by the canary are not automatically deleted. After you delete a canary that you do not intend to use again, you should also delete the following:

  • The Lambda functions and layers used by this canary. These have the prefix cwsyn-MyCanaryName .

  • The CloudWatch alarms created for this canary. These alarms have a name of Synthetics-SharpDrop-Alarm-MyCanaryName .

  • Amazon S3 objects and buckets, such as the canary's artifact location.

  • IAM roles created for the canary. If they were created in the console, these roles have the name role/service-role/CloudWatchSyntheticsRole-MyCanaryName .

  • CloudWatch Logs log groups created for the canary. These logs groups have the name /aws/lambda/cwsyn-MyCanaryName .

Before you delete a canary, you might want to use GetCanary to display the information about this canary. Make note of the information returned by this operation so that you can delete these resources after you delete the canary.

Service Reference:

Examples:

Calling the deleteCanary operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
synthetics.deleteCanary(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      The name of the canary that you want to delete. To find the names of your canaries, use DescribeCanaries.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeCanaries(params = {}, callback) ⇒ AWS.Request

This operation returns a list of the canaries in your account, along with full details about each canary.

This operation does not have resource-level authorization, so if a user is able to use DescribeCanaries, the user can see all of the canaries in the account. A deny policy can only be used to restrict access to all canaries. It cannot be used on specific resources.

Service Reference:

Examples:

Calling the describeCanaries operation

var params = {
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
synthetics.describeCanaries(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • NextToken — (String)

      A token that indicates that there is more data available. You can use this token in a subsequent operation to retrieve the next set of results.

    • MaxResults — (Integer)

      Specify this parameter to limit how many canaries are returned each time you use the DescribeCanaries operation. If you omit this parameter, the default of 100 is used.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Canaries — (Array<map>)

        Returns an array. Each item in the array contains the full information about one canary.

        • Id — (String)

          The unique ID of this canary.

        • Name — (String)

          The name of the canary.

        • Code — (map)

          This structure contains information about the canary's Lambda handler and where its code is stored by CloudWatch Synthetics.

          • SourceLocationArn — (String)

            The ARN of the Lambda layer where Synthetics stores the canary script code.

          • Handler — (String)

            The entry point to use for the source code when running the canary.

        • ExecutionRoleArn — (String)

          The ARN of the IAM role used to run the canary. This role must include lambda.amazonaws.com as a principal in the trust policy.

        • Schedule — (map)

          A structure that contains information about how often the canary is to run, and when these runs are to stop.

          • Expression — (String)

            A rate expression that defines how often the canary is to run. The syntax is rate(number unit). unit can be minute, minutes, or hour.

            For example, rate(1 minute) runs the canary once a minute, rate(10 minutes) runs it once every 10 minutes, and rate(1 hour) runs it once every hour.

            Specifying rate(0 minute) or rate(0 hour) is a special value that causes the canary to run only once when it is started.

          • DurationInSeconds — (Integer)

            How long, in seconds, for the canary to continue making regular runs after it was created. The runs are performed according to the schedule in the Expression value.

        • RunConfig — (map)

          A structure that contains information about a canary run.

          • TimeoutInSeconds — (Integer)

            How long the canary is allowed to run before it must stop.

          • MemoryInMB — (Integer)

            The maximum amount of memory available to the canary while it is running, in MB. This value must be a multiple of 64.

          • ActiveTracing — (Boolean)

            Displays whether this canary run used active AWS X-Ray tracing.

        • SuccessRetentionPeriodInDays — (Integer)

          The number of days to retain data about successful runs of this canary.

        • FailureRetentionPeriodInDays — (Integer)

          The number of days to retain data about failed runs of this canary.

        • Status — (map)

          A structure that contains information about the canary's status.

          • State — (String)

            The current state of the canary.

            Possible values include:
            • "CREATING"
            • "READY"
            • "STARTING"
            • "RUNNING"
            • "UPDATING"
            • "STOPPING"
            • "STOPPED"
            • "ERROR"
            • "DELETING"
          • StateReason — (String)

            If the canary has insufficient permissions to run, this field provides more details.

          • StateReasonCode — (String)

            If the canary cannot run or has failed, this field displays the reason.

            Possible values include:
            • "INVALID_PERMISSIONS"
        • Timeline — (map)

          A structure that contains information about when the canary was created, modified, and most recently run.

          • Created — (Date)

            The date and time the canary was created.

          • LastModified — (Date)

            The date and time the canary was most recently modified.

          • LastStarted — (Date)

            The date and time that the canary's most recent run started.

          • LastStopped — (Date)

            The date and time that the canary's most recent run ended.

        • ArtifactS3Location — (String)

          The location in Amazon S3 where Synthetics stores artifacts from the runs of this canary. Artifacts include the log file, screenshots, and HAR files.

        • EngineArn — (String)

          The ARN of the Lambda function that is used as your canary's engine. For more information about Lambda ARN format, see Resources and Conditions for Lambda Actions.

        • RuntimeVersion — (String)

          Specifies the runtime version to use for the canary. For more information about runtime versions, see Canary Runtime Versions.

        • VpcConfig — (map)

          If this canary is to test an endpoint in a VPC, this structure contains information about the subnets and security groups of the VPC endpoint. For more information, see Running a Canary in a VPC.

          • VpcId — (String)

            The IDs of the VPC where this canary is to run.

          • SubnetIds — (Array<String>)

            The IDs of the subnets where this canary is to run.

          • SecurityGroupIds — (Array<String>)

            The IDs of the security groups for this canary.

        • Tags — (map<String>)

          The list of key-value pairs that are associated with the canary.

      • NextToken — (String)

        A token that indicates that there is more data available. You can use this token in a subsequent DescribeCanaries operation to retrieve the next set of results.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeCanariesLastRun(params = {}, callback) ⇒ AWS.Request

Use this operation to see information from the most recent run of each canary that you have created.

Service Reference:

Examples:

Calling the describeCanariesLastRun operation

var params = {
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
synthetics.describeCanariesLastRun(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • NextToken — (String)

      A token that indicates that there is more data available. You can use this token in a subsequent DescribeCanaries operation to retrieve the next set of results.

    • MaxResults — (Integer)

      Specify this parameter to limit how many runs are returned each time you use the DescribeLastRun operation. If you omit this parameter, the default of 100 is used.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • CanariesLastRun — (Array<map>)

        An array that contains the information from the most recent run of each canary.

        • CanaryName — (String)

          The name of the canary.

        • LastRun — (map)

          The results from this canary's most recent run.

          • Id — (String)

            A unique ID that identifies this canary run.

          • Name — (String)

            The name of the canary.

          • Status — (map)

            The status of this run.

            • State — (String)

              The current state of the run.

              Possible values include:
              • "RUNNING"
              • "PASSED"
              • "FAILED"
            • StateReason — (String)

              If run of the canary failed, this field contains the reason for the error.

            • StateReasonCode — (String)

              If this value is CANARY_FAILURE, an exception occurred in the canary code. If this value is EXECUTION_FAILURE, an exception occurred in CloudWatch Synthetics.

              Possible values include:
              • "CANARY_FAILURE"
              • "EXECUTION_FAILURE"
          • Timeline — (map)

            A structure that contains the start and end times of this run.

            • Started — (Date)

              The start time of the run.

            • Completed — (Date)

              The end time of the run.

          • ArtifactS3Location — (String)

            The location where the canary stored artifacts from the run. Artifacts include the log file, screenshots, and HAR files.

      • NextToken — (String)

        A token that indicates that there is more data available. You can use this token in a subsequent DescribeCanariesLastRun operation to retrieve the next set of results.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeRuntimeVersions(params = {}, callback) ⇒ AWS.Request

Returns a list of Synthetics canary runtime versions. For more information, see Canary Runtime Versions.

Service Reference:

Examples:

Calling the describeRuntimeVersions operation

var params = {
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
synthetics.describeRuntimeVersions(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • NextToken — (String)

      A token that indicates that there is more data available. You can use this token in a subsequent DescribeRuntimeVersions operation to retrieve the next set of results.

    • MaxResults — (Integer)

      Specify this parameter to limit how many runs are returned each time you use the DescribeRuntimeVersions operation. If you omit this parameter, the default of 100 is used.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • RuntimeVersions — (Array<map>)

        An array of objects that display the details about each Synthetics canary runtime version.

        • VersionName — (String)

          The name of the runtime version. For a list of valid runtime versions, see Canary Runtime Versions.

        • Description — (String)

          A description of the runtime version, created by Amazon.

        • ReleaseDate — (Date)

          The date that the runtime version was released.

        • DeprecationDate — (Date)

          If this runtime version is deprecated, this value is the date of deprecation.

      • NextToken — (String)

        A token that indicates that there is more data available. You can use this token in a subsequent DescribeRuntimeVersions operation to retrieve the next set of results.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getCanary(params = {}, callback) ⇒ AWS.Request

Retrieves complete information about one canary. You must specify the name of the canary that you want. To get a list of canaries and their names, use DescribeCanaries.

Service Reference:

Examples:

Calling the getCanary operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
synthetics.getCanary(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      The name of the canary that you want details for.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Canary — (map)

        A strucure that contains the full information about the canary.

        • Id — (String)

          The unique ID of this canary.

        • Name — (String)

          The name of the canary.

        • Code — (map)

          This structure contains information about the canary's Lambda handler and where its code is stored by CloudWatch Synthetics.

          • SourceLocationArn — (String)

            The ARN of the Lambda layer where Synthetics stores the canary script code.

          • Handler — (String)

            The entry point to use for the source code when running the canary.

        • ExecutionRoleArn — (String)

          The ARN of the IAM role used to run the canary. This role must include lambda.amazonaws.com as a principal in the trust policy.

        • Schedule — (map)

          A structure that contains information about how often the canary is to run, and when these runs are to stop.

          • Expression — (String)

            A rate expression that defines how often the canary is to run. The syntax is rate(number unit). unit can be minute, minutes, or hour.

            For example, rate(1 minute) runs the canary once a minute, rate(10 minutes) runs it once every 10 minutes, and rate(1 hour) runs it once every hour.

            Specifying rate(0 minute) or rate(0 hour) is a special value that causes the canary to run only once when it is started.

          • DurationInSeconds — (Integer)

            How long, in seconds, for the canary to continue making regular runs after it was created. The runs are performed according to the schedule in the Expression value.

        • RunConfig — (map)

          A structure that contains information about a canary run.

          • TimeoutInSeconds — (Integer)

            How long the canary is allowed to run before it must stop.

          • MemoryInMB — (Integer)

            The maximum amount of memory available to the canary while it is running, in MB. This value must be a multiple of 64.

          • ActiveTracing — (Boolean)

            Displays whether this canary run used active AWS X-Ray tracing.

        • SuccessRetentionPeriodInDays — (Integer)

          The number of days to retain data about successful runs of this canary.

        • FailureRetentionPeriodInDays — (Integer)

          The number of days to retain data about failed runs of this canary.

        • Status — (map)

          A structure that contains information about the canary's status.

          • State — (String)

            The current state of the canary.

            Possible values include:
            • "CREATING"
            • "READY"
            • "STARTING"
            • "RUNNING"
            • "UPDATING"
            • "STOPPING"
            • "STOPPED"
            • "ERROR"
            • "DELETING"
          • StateReason — (String)

            If the canary has insufficient permissions to run, this field provides more details.

          • StateReasonCode — (String)

            If the canary cannot run or has failed, this field displays the reason.

            Possible values include:
            • "INVALID_PERMISSIONS"
        • Timeline — (map)

          A structure that contains information about when the canary was created, modified, and most recently run.

          • Created — (Date)

            The date and time the canary was created.

          • LastModified — (Date)

            The date and time the canary was most recently modified.

          • LastStarted — (Date)

            The date and time that the canary's most recent run started.

          • LastStopped — (Date)

            The date and time that the canary's most recent run ended.

        • ArtifactS3Location — (String)

          The location in Amazon S3 where Synthetics stores artifacts from the runs of this canary. Artifacts include the log file, screenshots, and HAR files.

        • EngineArn — (String)

          The ARN of the Lambda function that is used as your canary's engine. For more information about Lambda ARN format, see Resources and Conditions for Lambda Actions.

        • RuntimeVersion — (String)

          Specifies the runtime version to use for the canary. For more information about runtime versions, see Canary Runtime Versions.

        • VpcConfig — (map)

          If this canary is to test an endpoint in a VPC, this structure contains information about the subnets and security groups of the VPC endpoint. For more information, see Running a Canary in a VPC.

          • VpcId — (String)

            The IDs of the VPC where this canary is to run.

          • SubnetIds — (Array<String>)

            The IDs of the subnets where this canary is to run.

          • SecurityGroupIds — (Array<String>)

            The IDs of the security groups for this canary.

        • Tags — (map<String>)

          The list of key-value pairs that are associated with the canary.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getCanaryRuns(params = {}, callback) ⇒ AWS.Request

Retrieves a list of runs for a specified canary.

Service Reference:

Examples:

Calling the getCanaryRuns operation

var params = {
  Name: 'STRING_VALUE', /* required */
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE'
};
synthetics.getCanaryRuns(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      The name of the canary that you want to see runs for.

    • NextToken — (String)

      A token that indicates that there is more data available. You can use this token in a subsequent GetCanaryRuns operation to retrieve the next set of results.

    • MaxResults — (Integer)

      Specify this parameter to limit how many runs are returned each time you use the GetCanaryRuns operation. If you omit this parameter, the default of 100 is used.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • CanaryRuns — (Array<map>)

        An array of structures. Each structure contains the details of one of the retrieved canary runs.

        • Id — (String)

          A unique ID that identifies this canary run.

        • Name — (String)

          The name of the canary.

        • Status — (map)

          The status of this run.

          • State — (String)

            The current state of the run.

            Possible values include:
            • "RUNNING"
            • "PASSED"
            • "FAILED"
          • StateReason — (String)

            If run of the canary failed, this field contains the reason for the error.

          • StateReasonCode — (String)

            If this value is CANARY_FAILURE, an exception occurred in the canary code. If this value is EXECUTION_FAILURE, an exception occurred in CloudWatch Synthetics.

            Possible values include:
            • "CANARY_FAILURE"
            • "EXECUTION_FAILURE"
        • Timeline — (map)

          A structure that contains the start and end times of this run.

          • Started — (Date)

            The start time of the run.

          • Completed — (Date)

            The end time of the run.

        • ArtifactS3Location — (String)

          The location where the canary stored artifacts from the run. Artifacts include the log file, screenshots, and HAR files.

      • NextToken — (String)

        A token that indicates that there is more data available. You can use this token in a subsequent GetCanaryRuns operation to retrieve the next set of results.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listTagsForResource(params = {}, callback) ⇒ AWS.Request

Displays the tags associated with a canary.

Service Reference:

Examples:

Calling the listTagsForResource operation

var params = {
  ResourceArn: 'STRING_VALUE' /* required */
};
synthetics.listTagsForResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArn — (String)

      The ARN of the canary that you want to view tags for.

      The ARN format of a canary is arn:aws:synthetics:Region:account-id:canary:canary-name .

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Tags — (map<String>)

        The list of tag keys and values associated with the canary that you specified.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

startCanary(params = {}, callback) ⇒ AWS.Request

Use this operation to run a canary that has already been created. The frequency of the canary runs is determined by the value of the canary's Schedule. To see a canary's schedule, use GetCanary.

Service Reference:

Examples:

Calling the startCanary operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
synthetics.startCanary(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      The name of the canary that you want to run. To find canary names, use DescribeCanaries.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

stopCanary(params = {}, callback) ⇒ AWS.Request

Stops the canary to prevent all future runs. If the canary is currently running, Synthetics stops waiting for the current run of the specified canary to complete. The run that is in progress completes on its own, publishes metrics, and uploads artifacts, but it is not recorded in Synthetics as a completed run.

You can use StartCanary to start it running again with the canary’s current schedule at any point in the future.

Service Reference:

Examples:

Calling the stopCanary operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
synthetics.stopCanary(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      The name of the canary that you want to stop. To find the names of your canaries, use DescribeCanaries.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

tagResource(params = {}, callback) ⇒ AWS.Request

Assigns one or more tags (key-value pairs) to the specified canary.

Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only resources with certain tag values.

Tags don't have any semantic meaning to AWS and are interpreted strictly as strings of characters.

You can use the TagResource action with a canary that already has tags. If you specify a new tag key for the alarm, this tag is appended to the list of tags associated with the alarm. If you specify a tag key that is already associated with the alarm, the new tag value that you specify replaces the previous value for that tag.

You can associate as many as 50 tags with a canary.

Service Reference:

Examples:

Calling the tagResource operation

var params = {
  ResourceArn: 'STRING_VALUE', /* required */
  Tags: { /* required */
    '<TagKey>': 'STRING_VALUE',
    /* '<TagKey>': ... */
  }
};
synthetics.tagResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArn — (String)

      The ARN of the canary that you're adding tags to.

      The ARN format of a canary is arn:aws:synthetics:Region:account-id:canary:canary-name .

    • Tags — (map<String>)

      The list of key-value pairs to associate with the canary.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

untagResource(params = {}, callback) ⇒ AWS.Request

Removes one or more tags from the specified canary.

Service Reference:

Examples:

Calling the untagResource operation

var params = {
  ResourceArn: 'STRING_VALUE', /* required */
  TagKeys: [ /* required */
    'STRING_VALUE',
    /* more items */
  ]
};
synthetics.untagResource(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • ResourceArn — (String)

      The ARN of the canary that you're removing tags from.

      The ARN format of a canary is arn:aws:synthetics:Region:account-id:canary:canary-name .

    • TagKeys — (Array<String>)

      The list of tag keys to remove from the resource.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

updateCanary(params = {}, callback) ⇒ AWS.Request

Use this operation to change the settings of a canary that has already been created.

You can't use this operation to update the tags of an existing canary. To change the tags of an existing canary, use TagResource.

Service Reference:

Examples:

Calling the updateCanary operation

var params = {
  Name: 'STRING_VALUE', /* required */
  Code: {
    Handler: 'STRING_VALUE', /* required */
    S3Bucket: 'STRING_VALUE',
    S3Key: 'STRING_VALUE',
    S3Version: 'STRING_VALUE',
    ZipFile: Buffer.from('...') || 'STRING_VALUE' /* Strings will be Base-64 encoded on your behalf */
  },
  ExecutionRoleArn: 'STRING_VALUE',
  FailureRetentionPeriodInDays: 'NUMBER_VALUE',
  RunConfig: {
    ActiveTracing: true || false,
    EnvironmentVariables: {
      '<EnvironmentVariableName>': 'STRING_VALUE',
      /* '<EnvironmentVariableName>': ... */
    },
    MemoryInMB: 'NUMBER_VALUE',
    TimeoutInSeconds: 'NUMBER_VALUE'
  },
  RuntimeVersion: 'STRING_VALUE',
  Schedule: {
    Expression: 'STRING_VALUE', /* required */
    DurationInSeconds: 'NUMBER_VALUE'
  },
  SuccessRetentionPeriodInDays: 'NUMBER_VALUE',
  VpcConfig: {
    SecurityGroupIds: [
      'STRING_VALUE',
      /* more items */
    ],
    SubnetIds: [
      'STRING_VALUE',
      /* more items */
    ]
  }
};
synthetics.updateCanary(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      The name of the canary that you want to update. To find the names of your canaries, use DescribeCanaries.

      You cannot change the name of a canary that has already been created.

    • Code — (map)

      A structure that includes the entry point from which the canary should start running your script. If the script is stored in an S3 bucket, the bucket name, key, and version are also included.

      • S3Bucket — (String)

        If your canary script is located in S3, specify the full bucket name here. The bucket must already exist. Specify the full bucket name, including s3:// as the start of the bucket name.

      • S3Key — (String)

        The S3 key of your script. For more information, see Working with Amazon S3 Objects.

      • S3Version — (String)

        The S3 version ID of your script.

      • ZipFile — (Buffer, Typed Array, Blob, String)

        If you input your canary script directly into the canary instead of referring to an S3 location, the value of this parameter is the .zip file that contains the script. It can be up to 5 MB.

      • Handlerrequired — (String)

        The entry point to use for the source code when running the canary. This value must end with the string .handler.

    • ExecutionRoleArn — (String)

      The ARN of the IAM role to be used to run the canary. This role must already exist, and must include lambda.amazonaws.com as a principal in the trust policy. The role must also have the following permissions:

      • s3:PutObject

      • s3:GetBucketLocation

      • s3:ListAllMyBuckets

      • cloudwatch:PutMetricData

      • logs:CreateLogGroup

      • logs:CreateLogStream

      • logs:CreateLogStream

    • RuntimeVersion — (String)

      Specifies the runtime version to use for the canary. For a list of valid runtime versions and for more information about runtime versions, see Canary Runtime Versions.

    • Schedule — (map)

      A structure that contains information about how often the canary is to run, and when these runs are to stop.

      • Expressionrequired — (String)

        A rate expression that defines how often the canary is to run. The syntax is rate(number unit). unit can be minute, minutes, or hour.

        For example, rate(1 minute) runs the canary once a minute, rate(10 minutes) runs it once every 10 minutes, and rate(1 hour) runs it once every hour. You can specify a frequency between rate(1 minute) and rate(1 hour).

        Specifying rate(0 minute) or rate(0 hour) is a special value that causes the canary to run only once when it is started.

      • DurationInSeconds — (Integer)

        How long, in seconds, for the canary to continue making regular runs according to the schedule in the Expression value. If you specify 0, the canary continues making runs until you stop it. If you omit this field, the default of 0 is used.

    • RunConfig — (map)

      A structure that contains the timeout value that is used for each individual run of the canary.

      • TimeoutInSeconds — (Integer)

        How long the canary is allowed to run before it must stop. You can't set this time to be longer than the frequency of the runs of this canary.

        If you omit this field, the frequency of the canary is used as this value, up to a maximum of 14 minutes.

      • MemoryInMB — (Integer)

        The maximum amount of memory available to the canary while it is running, in MB. This value must be a multiple of 64.

      • ActiveTracing — (Boolean)

        Specifies whether this canary is to use active AWS X-Ray tracing when it runs. Active tracing enables this canary run to be displayed in the ServiceLens and X-Ray service maps even if the canary does not hit an endpoint that has X-ray tracing enabled. Using X-Ray tracing incurs charges. For more information, see Canaries and X-Ray tracing.

        You can enable active tracing only for canaries that use version syn-nodejs-2.0 or later for their canary runtime.

      • EnvironmentVariables — (map<String>)

        Specifies the keys and values to use for any environment variables used in the canary script. Use the following format:

        { "key1" : "value1", "key2" : "value2", ...}

        Keys must start with a letter and be at least two characters. The total size of your environment variables cannot exceed 4 KB. You can't specify any Lambda reserved environment variables as the keys for your environment variables. For more information about reserved keys, see Runtime environment variables.

    • SuccessRetentionPeriodInDays — (Integer)

      The number of days to retain data about successful runs of this canary.

    • FailureRetentionPeriodInDays — (Integer)

      The number of days to retain data about failed runs of this canary.

    • VpcConfig — (map)

      If this canary is to test an endpoint in a VPC, this structure contains information about the subnet and security groups of the VPC endpoint. For more information, see Running a Canary in a VPC.

      • SubnetIds — (Array<String>)

        The IDs of the subnets where this canary is to run.

      • SecurityGroupIds — (Array<String>)

        The IDs of the security groups for this canary.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.