aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.7k stars 3.93k forks source link

(aws-scheduler-targets-alpha): Add EcsStartTask Target #27456

Open filletofish opened 1 year ago

filletofish commented 1 year ago

Describe the feature

Work to support L2 constructs for AWS Scheduler is in progress (https://github.com/aws/aws-cdk/issues/23394). See the approved RFC. RFC planned to add 12 templates targets, but only Lambda Invoke is currently implemented (https://github.com/aws/aws-cdk/pull/26575).

This issue tracks implementation of EcsStartTask target to start a task on an Amazon ECS Cluster.

Use Case

Customers would like to use templated target EcsStartTask to be able to start a ECS Task on schedule. L2 target construct should grant required permissions to the AWS Scheduler to start tasks on a ECS Cluster.

Proposed Solution

The proposed solution needs to be adopted to the recent examples of LambdaInvoke (https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts).

Solution should also include unit and integration tests.

Class EcsStartTask should:

  1. Grant Scheduler Execution Role permissions to start a task via addTargetActionToRole
  2. Override bindBaseTargetConfig to return ecsParameters as part of ScheduleTargetConfig.

Other Information

No response

Acknowledgements

CDK version used

2.99.1

Environment details (OS name and version, etc.)

MacOS

pahud commented 1 year ago

Thank you for all those feature requests and PRs!

azatoth commented 1 year ago

How will this be featured compared to https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs_patterns.ScheduledFargateTask.html and https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs_patterns.ScheduledEc2Task.html? My feeling is that this feature should deprecate the old ones.

Taikono-Himazin commented 7 months ago

Is there any progress on this?