auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps) => {
}
return [
{
timestamp: +new Date(steps.trigger.context.ts),
message: "Hello, world"
}
]
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, params) => {
}
this.logGroupName = params.logGroupName
this.logStreamName = params.logStreamName
this.awsRegion = params.region
auths
objectreturn
or this.key = 'value'
, pass input data to your code viaparams
, and maintain state across executions with$checkpoint.async
(event, steps, params, auths) => {
}
// We need to pass a "sequence token" to CloudWatch to write logs to a specicic stream.
// From the AWS docs:
// "The sequence token obtained from the response of the previous PutLogEvents call.
// An upload in a newly created log stream does not need a sequence token.
// You can also get the sequence token using DescribeLogStreams"
const AWS = require("aws-sdk")
const { accessKeyId, secretAccessKey } = auths.aws
const logs = new AWS.CloudWatchLogs({
accessKeyId,
secretAccessKey,
region: params.region,
})
const { logStreams } = await logs.describeLogStreams({
logGroupName: params.logGroupName,
}).promise()
// Find our target log stream, and return its sequence token
const stream = logStreams.find(s => s.logStreamName === steps.CONSTANTS.logStreamName)
return stream?.uploadSequenceToken
Uploads a batch of log events to the specified log stream. See the docs for more information
The AWS region string where you'd like to create your SNS topic
The name of the log group you'd like to write logs to
The name of the log stream within your log group
An array of log events. Each log event must contain a timestamp
(the time the event occurred) and a message
. See the docs
The sequence token obtained from the response of the previous PutLogEvents
call. An upload in a newly created log stream does not need a sequence token. You can also get the sequence token using DescribeLogStreams
. If you call PutLogEvents
twice within a narrow time period using the same value for sequenceToken, both calls might be successful or one might be rejected.