- Newest
- Most votes
- Most comments
Looking at the documentation, what you are trying to do is not supported. TargetAction is limited to
{
"PauseCluster" : PauseClusterMessage,
"ResizeCluster" : ResizeClusterMessage,
"ResumeCluster" : ResumeClusterMessage
}
You could use EventBridge instead to schedule some queries and use CloudFormation to do it.
I tried to schedule the redshift query using eventbridge, at max it led to adding the query in the list of scheduled queries in redshift but query was never executed and I got the info that eventbridge cannot send request or make call to redshift data api.
Code Snippet using eventbridge
RedshiftSchedule:
Type: AWS::Events::Rule
DependsOn: [QrLogGroup, RedshiftScheduledQueryRoles]
Properties:
EventBusName: default
Description: "Schedule for Redshift Query Execution"
ScheduleExpression: cron(52 18 * * ? *)
State: "ENABLED"
Targets:
- Id: QueryExecution
Arn: arn:aws:redshift:eu-west-1:880478141414:cluster:alamar-data-platform-redshift-dev
RoleArn: !GetAtt RedshiftScheduledQueryRoles.Arn
RedshiftDataParameters:
DbUser: rsadmin
#ClusterIdentifier: alamar-data-platform-redshift-dev
#SecretManagerArn: "arn:aws:secretsmanager:eu-west-1:880478141414:secret:testing-secret-VQU8jo"
Database: redshiftdb
Sql: select gross_sales, profit, order_count, branch_localized, branch_reference, foodics_account_id,
market, order_date from foodics_reports.foodics_daily_sales where market='Morocco' and
order_date='2024-05-20' order by order_date desc;
StatementName: test-redshift-cluster-data
WithEvent: true
- Id: QueryLoging
Arn: !GetAtt QrLogGroup.Arn
provide me solution on how to schedule redshift queries how to add saved query in redshift using cloudformation yaml script (esp without using any third service) and what is the scope and usage of cloudformation custom resource in this regard?
I’m 99% sure setting up a “query editor” scheduled query isn’t supported using any kind of automation. Best u can do is schedule a lambda that calls the query (and if it’s long running doesn’t wait for it to return). Set up a scheduled query through the editor and then look at the event bridge rule it creates, it’s actually pointing to some internal redshift thingy query editor created I think. I mean maybe u can backward engineer it, love to know if u get it to work. I gave up on it and just used cloud formation to set up the proper iam stuff so I could then go and add the scheduled query myself.
Relevant content
- asked 8 months ago
- asked 2 years ago
- Accepted Answerasked 6 months ago
- asked 3 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 5 days ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago