I'm new to Redshift and quite a beginner in AWS. I have a Redshift Cluster, and I need to execute a bash script- that has some SQLs running inside of it. Is there any way I can execute my Bash script on my Redshift Cluster? I want to be able to connect to the Redshift Cluster, execute the Bash Script and all the SQLs inside on the cluster.
Can I do this through Lambda? A little detail will be appreciated.
CodePudding user response:
This is possible through lambda if you wanna use the bash script. But if you wanna just execute sqls, wrap those sqls in a .sql script and use Redshift query scheduler to schedule these via either manual schedule run or cron job schedule run
CodePudding user response:
Amazon Redshift is a database. You can connect to it via JDBC or via the Redshift Data API and then run SQL commands against the database. However, it is not a compute platform.
While Amazon Redshift does have the ability to run stored procedures, bash scripts cannot be run.
You would need to run your script on a compute platform (eg an Amazon EC2 instance or your own computer), and it can 'call' the Amazon Redshift cluster to run the SQL.
AWS Lambda can run bash scripts, although you would need to do some setup to support it. You would be better-off rewriting your code to work in a natively-supported language.