Show me an example serverless framework yml that creates a periodic ECS task using an…
- User
Show me an example serverless framework yml that creates a periodic ECS task using an image in ECR on AWS
Assistant
Here is an example serverless.yml file that creates a periodic ECS task using an image in ECR on AWS with the Serverless Framework:
service: my-service provider: name: aws runtime: python3.8 region: us-east-1 functions: run-task: handler: handler.run events: - schedule: rate(1 hour) reservedConcurrency: 1 resources: Resources: EcsTaskDefinition: Type: AWS::ECS::TaskDefinition Properties: ContainerDefinitions: - Name: my-container Image: ${self:provider.environment.ECS_IMAGE} Memory: 512 Essential: true TaskRoleArn: ${self:provider.environment.ECS_TASK_ROLE_ARN} Cpu: 256 ExecutionRoleArn: ${self:provider.environment.ECS_EXECUTION_ROLE_ARN} Family: ${self:service}-${self:provider.stage}-ecs-td NetworkMode: awsvpc Outputs: EcsTaskDefinitionArn: Value: ${self:resources.Resources.EcsTaskDefinition.Arn} plugins: - serverless-ecs-tasks provider: environment: ECS_IMAGE: ${aws:AccountId}.dkr.ecr.${aws:region}.amazonaws.com/my-ecr-repo:latest ECS_TASK_ROLE_ARN: arn:aws:iam::${aws:AccountId}:role/ecsTaskRole ECS_EXECUTION_ROLE_ARN: arn:aws:iam::${aws:AccountId}:role/ecsTaskExecutionRole
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.