How do I updated a CloudWatch Synthetics Canary layer version number using the AWS CLI?

0

Hello,

I created a CloudWatch Synthetics Canary via a console blueprint

I want to update the active layer version ("39" – bolded below) using the AWS CLI

I see it in the Code["SourceLocationArn"] attribute in my describe-canary response

The update-canary operation doesn't have a SourceLocationArn option for the --code value.

How do I updated the layer version number using the AWS CLI?

Thank you

        {
            "Id": "aae1dc97-773b-47bb-ae72-d0bb54eec60c",
            "Name": "daily-wisdom-texts",
            "Code": {
**                "SourceLocationArn": "arn:aws:lambda:us-east-1:875425895862:layer:cwsyn-daily-wisdom-texts-aae1dc97-773b-47bb-ae72-d0bb54eec60c:39",
**                "Handler": "pageLoadBlueprint.handler"
            },
            "ExecutionRoleArn": "arn:aws:iam::875425895862:role/service-role/CloudWatchSyntheticsRole-daily-wisdom-texts-cf9-de04b4eb2bb3",
            "Schedule": {
                "Expression": "rate(1 hour)",
                "DurationInSeconds": 0
            },
            "RunConfig": {
                "TimeoutInSeconds": 60,
                "MemoryInMB": 1000,
                "ActiveTracing": false
            },
            "SuccessRetentionPeriodInDays": 31,
            "FailureRetentionPeriodInDays": 31,
            "Status": {
                "State": "RUNNING",
                "StateReasonCode": "UPDATE_COMPLETE"
            },
            "Timeline": {
                "Created": 1641343713.153,
                "LastModified": 1652481443.745,
                "LastStarted": 1652481444.83,
                "LastStopped": 1641675597.0
            },
            "ArtifactS3Location": "cw-syn-results-875425895862-us-east-1/canary/us-east-1/daily-wisdom-texts-cf9-de04b4eb2bb3",
            "EngineArn": "arn:aws:lambda:us-east-1:875425895862:function:cwsyn-daily-wisdom-texts-aae1dc97-773b-47bb-ae72-d0bb54eec60c:57",
            "RuntimeVersion": "syn-python-selenium-1.0",
            "Tags": {
                "blueprint": "heartbeat"
            }
        }

1 回答
0

The number at the end of SourceLocationArn is the version of the Lambda layer you are using. The number gets incremented when some parts of the Lambda function are updated. Therefore, you cannot update with update-canary operation.

Lambda codes are included in the layer. You can see the numbers of layers on Lambda console. Select as follows: CloudWatch -> Synthetics Canaries -> <select your canary> -> Configuration -> Canary script Script location <https>. (That leads to lambda layers page.)

shimo
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则