(ecs-patterns): use existing Security Group with ScheduledFargateTask
See original GitHub issue❓ General Issue
Unable to find a way to specify an existing security group when creating task schedules for fargate tasks using aws cdk
The Question
When defining an ECS Task Schedule, I can’t seem to find a way of specifying an existing security group. Any pointers on where this can be configured using aws cdk?
In the code snippet below, you’ll see I am able to create a cron, specify the docker image to schedule and create the schedule itself by specifying the existing cluster and vpc. However, there is no option to specify an existing security group… Is it possible to specify an existing security group?
schedule_cron = scaling.Schedule.cron(minute=manifest['schedule']['minute'],
hour=manifest['schedule']['hour'],
day=manifest['schedule']['day'],
month=manifest['schedule']['month'],
year=manifest['schedule']['year'])
image_option = ecs_patterns.ScheduledFargateTaskImageOptions(image=img,
cpu=manifest["resources"]["cpu"],
memory_limit_mib=manifest["resources"]["memory"],
log_driver=ecs.AwsLogDriver(log_group=log_group,
stream_prefix=manifest["app_name"]),
secrets=secrets,
environment= env)
schedule_pattern = ecs_patterns.ScheduledFargateTask(self, f"scheduledtask{app_name}",
schedule= schedule_cron, scheduled_fargate_task_image_options=image_option, cluster=cluster,
desired_task_count=manifest["replica_count"], vpc=vpc)
When i do a cdk synth
i can see that cdk is trying to generate a new security group with some outbound and inbound rules. Instead, i would like to pass an existing security group that’s been defined with relevant organization access policies. Is it supported?
Environment
- CDK CLI Version: 1.15.0
- Module Version: 1.15.0
- OS: Windows
- Language: Python
Other information
Issue Analytics
- State:
- Created 4 years ago
- Reactions:20
- Comments:5 (3 by maintainers)
Top GitHub Comments
@tarunaroraonline this is currently not supported using the scheduled task (ec2/Fargate) constructs. I’ve tagged it as a feature request, but I’d be more than happy to review it if you’d like to submit a PR to address this issue.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.