What I want to do is on aws
is like this below.
At first my idea is
crond
and ftp
then put in fargate
.However, serverless fargate works by crond.....?
So second idea is
ftp
, then using EventBridge
to run ftp
command in container.Is it possible?
I wonder if I can run the command in container on fargate
by EventBridge
??
The first step would be to write a bash script that performs the FTP and SQL commands. Then create a container image that includes that bash script, and any dependencies such as mysql
or psql
. The container image will be configured with the bash script as the entrypoint. This means every time you launch an instance of this container it will perform the FTP and SQL commands, then exit.
Note how at this point all the commands like ftp
and the SQL stuff is configured completely inside the image, there is no need for an external service like EventBridge to push the command itself into the container. If there needs to be some configuration passed in, like the FTP server name, or the RDS hostname, those should be passed in as environment variables to the container.
Finally, to run this on ECS Fargate once an hour, you would configure the task definition in ECS, then configure an AWS ECS Scheduled Task, which uses EventBridge, with an hourly cron
trigger expression.