scheduled_actions
Creates, updates, deletes, gets or lists a scheduled_actions resource.
Overview
| Name | scheduled_actions |
| Type | Resource |
| Id | aws.redshift_serverless.scheduled_actions |
Fields
The following fields are returned by SELECT queries:
- get_scheduled_action
- list_scheduled_actions
| Name | Datatype | Description |
|---|---|---|
end_time | string (date-time) | The end time of |
namespace_name | string | The end time in UTC when the schedule is no longer active. After this time, the scheduled action does not trigger. (pattern: <code>^[a-z0-9-]+$</code>) |
next_invocations | array | An array of timestamps of when the next scheduled actions will trigger. |
role_arn | string | The ARN of the IAM role to assume to run the scheduled action. This IAM role must have permission to run the Amazon Redshift Serverless API operation in the scheduled action. This IAM role must allow the Amazon Redshift scheduler to schedule creating snapshots. (Principal scheduler.redshift.amazonaws.com) to assume permissions on your behalf. For more information about the IAM role to use with the Amazon Redshift scheduler, see Using Identity-Based Policies for Amazon Redshift in the Amazon Redshift Management Guide |
schedule | object | The schedule for a one-time (at timestamp format) or recurring (cron format) scheduled action. Schedule invocations must be separated by at least one hour. Times are in UTC. Format of at timestamp is yyyy-mm-ddThh:mm:ss. For example, 2016-03-04T17:27:00. Format of cron expression is (Minutes Hours Day-of-month Month Day-of-week Year). For example, "(0 10 ? * MON *)". For more information, see Cron Expressions in the Amazon CloudWatch Events User Guide. |
scheduled_action_description | string | The description of the scheduled action. |
scheduled_action_name | string | The name of the scheduled action. (pattern: <code>^[a-z0-9-]+$</code>) |
scheduled_action_uuid | string | The uuid of the scheduled action. |
start_time | string (date-time) | The start time in UTC when the schedule is active. Before this time, the scheduled action does not trigger. |
state | string | The state of the scheduled action. (ACTIVE, DISABLED) |
target_action | object | A JSON format string of the Amazon Redshift Serverless API operation with input parameters. The following is an example of a target action. "{"CreateSnapshot": {"NamespaceName": "sampleNamespace","SnapshotName": "sampleSnapshot", "retentionPeriod": "1"}}" |
| Name | Datatype | Description |
|---|---|---|
namespace_name | string | Name of associated Amazon Redshift Serverless namespace. (pattern: <code>^[a-z0-9-]+$</code>) |
scheduled_action_name | string | Name of associated scheduled action. (pattern: <code>^[a-z0-9-]+$</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_scheduled_action | select | region | Returns information about a scheduled action. | |
list_scheduled_actions | select | region | Returns a list of scheduled actions. You can use the flags to filter the list of returned scheduled actions. | |
create_scheduled_action | insert | region, namespaceName, roleArn, schedule, scheduledActionName, targetAction | Creates a scheduled action. A scheduled action contains a schedule and an Amazon Redshift API action. For example, you can create a schedule of when to run the CreateSnapshot API operation. | |
update_scheduled_action | update | region, scheduledActionName | Updates a scheduled action. | |
delete_scheduled_action | delete | region | Deletes a scheduled action. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_scheduled_action
- list_scheduled_actions
Returns information about a scheduled action.
SELECT
end_time,
namespace_name,
next_invocations,
role_arn,
schedule,
scheduled_action_description,
scheduled_action_name,
scheduled_action_uuid,
start_time,
state,
target_action
FROM aws.redshift_serverless.scheduled_actions
WHERE region = '{{ region }}' -- required
;
Returns a list of scheduled actions. You can use the flags to filter the list of returned scheduled actions.
SELECT
namespace_name,
scheduled_action_name
FROM aws.redshift_serverless.scheduled_actions
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_scheduled_action
- Manifest
Creates a scheduled action. A scheduled action contains a schedule and an Amazon Redshift API action. For example, you can create a schedule of when to run the CreateSnapshot API operation.
INSERT INTO aws.redshift_serverless.scheduled_actions (
enabled,
endTime,
namespaceName,
roleArn,
schedule,
scheduledActionDescription,
scheduledActionName,
startTime,
targetAction,
region
)
SELECT
{{ enabled }},
'{{ endTime }}',
'{{ namespaceName }}' /* required */,
'{{ roleArn }}' /* required */,
'{{ schedule }}' /* required */,
'{{ scheduledActionDescription }}',
'{{ scheduledActionName }}' /* required */,
'{{ startTime }}',
'{{ targetAction }}' /* required */,
'{{ region }}'
RETURNING
scheduled_action
;
# Description fields are for documentation purposes
- name: scheduled_actions
props:
- name: region
value: "{{ region }}"
description: Required parameter for the scheduled_actions resource.
- name: enabled
value: {{ enabled }}
description: |
Indicates whether the schedule is enabled. If false, the scheduled action does not trigger. For more information about state of the scheduled action, see ScheduledAction.
- name: endTime
value: "{{ endTime }}"
description: |
The end time in UTC when the schedule is no longer active. After this time, the scheduled action does not trigger.
- name: namespaceName
value: "{{ namespaceName }}"
description: |
The name of the namespace for which to create a scheduled action.
- name: roleArn
value: "{{ roleArn }}"
description: |
The ARN of the IAM role to assume to run the scheduled action. This IAM role must have permission to run the Amazon Redshift Serverless API operation in the scheduled action. This IAM role must allow the Amazon Redshift scheduler to schedule creating snapshots. (Principal scheduler.redshift.amazonaws.com) to assume permissions on your behalf. For more information about the IAM role to use with the Amazon Redshift scheduler, see Using Identity-Based Policies for Amazon Redshift in the Amazon Redshift Management Guide
- name: schedule
description: |
The schedule for a one-time (at timestamp format) or recurring (cron format) scheduled action. Schedule invocations must be separated by at least one hour. Times are in UTC. Format of at timestamp is yyyy-mm-ddThh:mm:ss. For example, 2016-03-04T17:27:00. Format of cron expression is (Minutes Hours Day-of-month Month Day-of-week Year). For example, "(0 10 ? * MON *)". For more information, see Cron Expressions in the Amazon CloudWatch Events User Guide.
value:
at: "{{ at }}"
cron: "{{ cron }}"
- name: scheduledActionDescription
value: "{{ scheduledActionDescription }}"
description: |
The description of the scheduled action.
- name: scheduledActionName
value: "{{ scheduledActionName }}"
description: |
The name of the scheduled action.
- name: startTime
value: "{{ startTime }}"
description: |
The start time in UTC when the schedule is active. Before this time, the scheduled action does not trigger.
- name: targetAction
description: |
A JSON format string of the Amazon Redshift Serverless API operation with input parameters. The following is an example of a target action. "{"CreateSnapshot": {"NamespaceName": "sampleNamespace","SnapshotName": "sampleSnapshot", "retentionPeriod": "1"}}"
value:
createSnapshot:
namespaceName: "{{ namespaceName }}"
retentionPeriod: {{ retentionPeriod }}
snapshotNamePrefix: "{{ snapshotNamePrefix }}"
tags:
- key: "{{ key }}"
value: "{{ value }}"
UPDATE examples
- update_scheduled_action
Updates a scheduled action.
UPDATE aws.redshift_serverless.scheduled_actions
SET
enabled = {{ enabled }},
endTime = '{{ endTime }}',
roleArn = '{{ roleArn }}',
schedule = '{{ schedule }}',
scheduledActionDescription = '{{ scheduledActionDescription }}',
scheduledActionName = '{{ scheduledActionName }}',
startTime = '{{ startTime }}',
targetAction = '{{ targetAction }}'
WHERE
region = '{{ region }}' --required
AND scheduledActionName = '{{ scheduledActionName }}' --required
RETURNING
scheduled_action;
DELETE examples
- delete_scheduled_action
Deletes a scheduled action.
DELETE FROM aws.redshift_serverless.scheduled_actions
WHERE region = '{{ region }}' --required
;