I am looking at a use case for fargate where I have some external trigger (perhaps a CloudWatch event) that triggers a Fargate task which opens a websocket connection, listens for a few hours and writes data to S3 and then ultimately closes the websocket after a few hours.
The websocket could either be closed by some external trigger, after a certain # of hours (generic timer) OR when it receives a specific message from the socket it closes.
Is this the right use case for fargate? The external trigger would pass in the websocket connection string and the secret auth token to authenticate could be stored with AWS KMS.
External trigger -> opens ws:// connection (through fargate) -> writes to S3
If this is the right use case, any advice on how to approach this? If this isn't the right use case, is there another service that is better for a persistent connection that is only a few hours?