{"id":16771971,"url":"https://github.com/eddmann/serverless-fargate","last_synced_at":"2025-04-04T06:08:56.070Z","repository":{"id":37077801,"uuid":"463543718","full_name":"eddmann/serverless-fargate","owner":"eddmann","description":"Maintain long-running Fargate ECS tasks within your Serverless project","archived":false,"fork":false,"pushed_at":"2025-02-14T18:06:03.000Z","size":66,"stargazers_count":55,"open_issues_count":9,"forks_count":23,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-22T13:40:22.072Z","etag":null,"topics":["aws","ecs","fargate","serverless","serverless-framework","serverless-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eddmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-25T13:30:24.000Z","updated_at":"2025-02-14T18:06:09.000Z","dependencies_parsed_at":"2024-07-12T19:33:14.580Z","dependency_job_id":"4d8bf8ab-f400-4dbc-b049-0a6aaa64214c","html_url":"https://github.com/eddmann/serverless-fargate","commit_stats":{"total_commits":49,"total_committers":8,"mean_commits":6.125,"dds":"0.22448979591836737","last_synced_commit":"6a3e1fadaad6c74be344eaa90a0b0155d2280f4e"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddmann%2Fserverless-fargate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddmann%2Fserverless-fargate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddmann%2Fserverless-fargate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddmann%2Fserverless-fargate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddmann","download_url":"https://codeload.github.com/eddmann/serverless-fargate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246774676,"owners_count":20831586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","ecs","fargate","serverless","serverless-framework","serverless-plugin"],"created_at":"2024-10-13T06:29:35.456Z","updated_at":"2025-04-04T06:08:56.031Z","avatar_url":"https://github.com/eddmann.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Serverless Fargate\n\nAdds the ability to maintain long-running Fargate ECS tasks within your Serverless project.\n\n## Overview\n\nNot all behaviour can be broken down and modelled within Lambda's execution duration constraints.\nSometimes you need the ability to exceed this duration, but wish to remain in a Serverless environment.\n\nThis plugin adds the ability to declare Fargate-backed ECS tasks which are provisioned during a Serverless deployment.\nTaking advantage of Serverless Frameworks ability to build/push images to ECR, you are able to declare both long-running and Lambda-based behaviour side-by-side.\n\nAt a high-level the plugin provides the following functionality:\n\n- Allows you to declare service-based (continuous) and scheduled tasks.\n- Uses the ECR image support provided within Serverless Framework to help build tasks.\n- Maintains an IAM role which honours all managed policies and statements that have been declared within the provider configuration.\n- Provides _escape-hatches_ to supply custom configuration such as role ARNs/tags etc.\n- Handles both Fargate and Fargate Spot execution environments.\n\n## Example\n\nBelow is an example configuration which highlights all possible available options.\n\n```yaml\nprovider:\n  # (required) similar to Lambda-containers, images defined within the provider are available to tasks.\n  ecr:\n    images:\n      my-task:\n        path: ./\n        file: Dockerfile\n\n  # (optional) role statements present within the provider are added to the task role.\n  iamRoleStatements:\n    - Effect: Allow\n      Action: 'sqs:*'\n      Resource: '*'\n\n  # (optional) managed polices present within the provider are added to the task role.\n  iamManagedPolicies:\n    - arn:aws:iam::123456:policy/my-managed-provider-policy\n\n  # (optional) environment variables present within the provider are added to all tasks.\n  environment:\n    name: value\n\n  vpc:\n    # (required) default security groups which are added to tasks that do not contain any overrides.\n    securityGroupIds:\n      - sg-12345\n\n    # (required) default subnets which are added to tasks that do not contain any overrides.\n    # all tasks MUST be assigned subnets as Fargate operates within `awsvpc` mode.\n    subnetIds:\n      - subnet-1234\n\n  # (optional) tags present within the provider are added to task resources.\n  tags:\n    name: value\n\nfargate:\n  # (optional) name used for the provisoned cluster; an auto-generated name by CloudFormation is used if not supplied.\n  clusterName: my-cluster-name\n\n  # (optional) enable CloudWatch Container Insights for the provisoned cluster; if specified this overrides the account-level setting.\n  containerInsights: true\n\n  # (optional) default memory you wish to allocate to each task (if not supplied at the task level) - defaults to 0.5GB.\n  # https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size\n  memory: '0.5GB'\n\n  # (optional) default CPU you wish to allocate to each task (if not supplied at the task level) - defaults to 256 (.25 vCPU).\n  # https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size\n  cpu: 256\n\n  # (optional) default CPU architecture you wish to use for each task (if not supplied at the task level)\n  # https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#runtime-platform\n  architecture: X86_64\n\n  # (optional) environment variables which are added to all tasks.\n  environment:\n    name: value\n\n  # (optional) name used for the provisoned log group.\n  logGroupName: my-cluster-log-group\n\n  # (optional) the number of days to retain the log events in the provisoned log group.\n  logRetentionInDays: 365\n\n  # (optional) default execution role ARN you wish to use for the task.\n  executionRoleArn: arn:aws:iam::123456:role/my-custom-execution-role\n\n  # (optional) default task role ARN you wish to use for the task.\n  taskRoleArn: arn:aws:iam::123456:role/my-custom-task-role\n\n  # (optional) additional role statements you wish to add to the task role, you would place statements here instead of at\n  # the provider level if you only wished them to target Fargate tasks.\n  iamRoleStatements:\n    - Effect: Allow\n      Action: 'resource:*'\n      Resource: '*'\n\n  # (optional) additional managed policies you wish to add to the task role, you would place policies here instead of at\n  # the provider level if you only wished them to target Fargate tasks.\n  iamManagedPolicies:\n    - arn:aws:iam::123456:policy/my-managed-task-policy\n\n  vpc:\n    # (optional) default security groups which are added to tasks that do not contain any overrides; these override any provider-level configuration.\n    securityGroupIds:\n      - sg-12345\n\n    # (required) default subnets which are added to tasks that do not contain any overrides; these override any provider-level configuration.\n    # all tasks MUST be assigned subnets as Fargate operates within `awsvpc` mode.\n    subnetIds:\n      - subnet-1234\n\n    # (optional) default flag to assign a public IP to each task, this requires the supplied subnets to be public (internet) facing.\n    assignPublicIp: false\n\n  # (optional) additional tags you wish to apply to only Fargate task resources.\n  tags:\n    name: value\n\n  # (optional) additional CloudFormation resource properties you wish to include for all compiled tasks.\n  # This provides a means of including properties present in the CloudFormation resource that are not exposed via the plugin DSL.\n  cloudFormationResource:\n    # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html\n    task:\n      EphemeralStorage: 5\n    # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html\n    container:\n      StopTimeout: 5\n    # container definitions you wish to run alongside the primary container\n    # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html\n    additionalContainers:\n      - Name: 'additional-container-name'\n        Image: 'additional-container-image'\n    # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html\n    service:\n      EnableECSManagedTags: 'true'\n\n  tasks:\n    my-task:\n      # (optional) unique name for the given task, defaults to the task key name.\n      name: my-task-name\n\n      # (required) the task image you wish to run, references images built within the `ecr` section.\n      image: my-task\n\n      # (optional) execution role ARN you wish to use for the given task.\n      executionRoleArn: arn:aws:iam::123456:role/my-custom-execution-role\n\n      # (optional) task role ARN you wish to use for the given task.\n      taskRoleArn: arn:aws:iam::123456:role/my-custom-task-role\n\n      vpc:\n        # (optional) security groups you wish to apply to the given tasks; these override any provider/fargate-level configuration.\n        securityGroupIds:\n          - sg-12345\n\n        # (required) subnets you wish to apply to the given tasks; these override any provider/fargate-level configuration.\n        # all tasks MUST be assigned subnets as Fargate operates within `awsvpc` mode.\n        subnetIds:\n          - subnet-1234\n\n        # (optional) flag to assign a public IP to the given task, this requires the supplied subnets to be public (internet) facing.\n        assignPublicIp: false\n\n      # (optional) the overridden command you wish to execute within the task container.\n      command:\n        - my-command\n\n      # (optional) the overridden entrypoint you wish to execute within the task container.\n      entryPoint:\n        - my-entrypoint\n\n      # (optional) memory you wish to allocate to the given task, defaults to the globally supplied memory value.\n      # https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size\n      memory: '0.5GB'\n\n      # (optional) CPU you wish to allocate to the given task, defaults to the globally supplied CPU value.\n      # https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#task_size\n      cpu: 256\n\n      # (optional) CPU architecture you wish to use for the given task, defaults to the globally supplied CPU architecture.\n      # https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#runtime-platform\n      architecture: ARM64\n\n      # (optional) environment variables which are added to the given task, these are combined with\n      # the globally supplied environment variables.\n      environment:\n        name: value\n\n      # (optional) additional tags you wish to apply to the given task, these are combined with\n      # the provider and globally supplied tags.\n      tags:\n        name: value\n\n      # (optional) ensure that the creation of task-related resources occur after listed resources.\n      dependsOn: ['MyExampleResource']\n\n      # (optional) by default a task is deemed to be a service with a desired count of one,\n      # this results in a single long-running process which is a typical use-case of the plugin.\n      # however, if you wish to alter this you can include the following configuration options.\n      service:\n        # (optional) the desired amount of running tasks for the given service.\n        desiredCount: 1\n\n        # (optional) used during deployment to determine how many tasks can be provisioned for the transition phase.\n        maximumPercent: 200\n\n        # (optional) used during deployment to determine how many tasks are required to remain active for the transition phase.\n        minimumHealthyPercent: 100\n\n        # (optional) flag to determine if you wish to provision the task using Fargate Spot.\n        # note: at this time there is no fallback measures in-place to ensure that the task will be provisioned using\n        # on-demand Fargate if the spot instance can not be acquired.\n        spot: false\n\n      # (optional) schedule expression used to configure the task to be executed at a desired time, as opposed to being a service.\n      # https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html\n      schedule: 'rate(1 minute)'\n\n      # (optional) additional CloudFormation resource properties you wish to include for this compiled task.\n      # This provides a means of including properties present in the CloudFormation resource that are not exposed via the plugin DSL.\n      cloudFormationResource:\n        # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html\n        task:\n          EphemeralStorage: 5\n        # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html\n        container:\n          StopTimeout: 5\n        # container definitions you wish to run alongside the primary container\n        # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html\n        additionalContainers:\n          - Name: 'additional-container-name'\n            Image: 'additional-container-image'\n        # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html\n        service:\n          EnableECSManagedTags: 'true'\n```\n\n---\n\nInspired by https://github.com/svdgraaf/serverless-fargate-tasks\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddmann%2Fserverless-fargate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddmann%2Fserverless-fargate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddmann%2Fserverless-fargate/lists"}