Open IsaacTrevino opened 3 years ago
Hi @IsaacTrevino are you saying you don't want any containers to remain provisioned between API calls and instead they are provisioned when a call is made and torn down after the call is finished? If so, I'm not sure that can be achieved, but you can take a look at the SchedulingStrategy CFN docs here.
To your second question, yes the ephemeral storage is included in the container. You can read more about task storage here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-task-storage.html
cc @manueliglesias @elorzafe to address your last question as I'm not sure about that.
@edwardfoyle Thanks for responding.
I managed to get it working with AWS Copilot CLI, though your right. API Gateway requires Public facing services to work with a provisioned container.
However, with copilot
I am able to create a scheduled container, and run it using ecs api action RunTask
from a regular amplify lambda function associated with amplify REST.
As a feature request:
This could probably be implemented in the future such that a command amplify add function
provides the options,
And then asks which API Rest to create your lambda function with ECS.RunTask or Implement yourself in a already created lambda function.
Thus similar to copilot init
with the scheduled function preselected.
This generates amplify/backend/function/<task name>-container-image
and generate a lambda function along side it amplify/backend/functions/<task name>
function to instantiate the container in the cluster.
I think the first step in solving this class of problem is to decouple serverless containers from the API category, then give the ability to configure how to the container is spun up (triggers, manual, etc), and when to reduce back to 0 running instances.
category: Advanced Workflow cli version: @aws-amplify/cli@4.44.1 service: Serverless Container (REST API express template)
AWS Fargate
As you know Amplify has released a Serverless Container integration using AWS Fargate, in my case I plan to use a serverless container to create a scheduled API microservice for my web apps backend. With the
ExpressJS - REST template
I am able to achieve my API needs, however I begin to realize that the container never shuts down after execution.I would use Amplify API Gateway and Lambda with a scheduler in cases like these however my new API may stretch over 15 minutes to somewhere under an hour I expect.
AWS Fargate docs says I can setup a stand-alone task to achieve one-time/scheduled API calls.
Is there a way to configure the settings in the
cloudformation-template
file generated by the amplify cli to get my desired outcome?Seconday Question
Also I noticed on the AWS ECS Console that there is no volume initialized with the container, is this due to the fact that the ephemeral storage is automatically included in the container. And why are we using platform version 1.3 instead of 1.4 for containers?