# AWS Ansible question - How do you link an ec2\_asg (security group) to a ecs\_cluster

**URL:** <https://forum.ansible.com/t/aws-ansible-question-how-do-you-link-an-ec2-asg-security-group-to-a-ecs-cluster/32810>\
**Category:** Ansible Developer\
**Tags:** aws\
**Created:** [April 29, 2020, 9:46am UTC](https://forum.ansible.com/t/aws-ansible-question-how-do-you-link-an-ec2-asg-security-group-to-a-ecs-cluster/32810 "2020-04-29T09:46:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sic](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@Sic](https://forum.ansible.com/u/Sic)\
**Post date:** [April 29, 2020, 9:46am UTC](https://forum.ansible.com/t/aws-ansible-question-how-do-you-link-an-ec2-asg-security-group-to-a-ecs-cluster/32810/1 "2020-04-29T09:46:45Z")

</div>

I’m attempting to automate the deployment of a project to an ecs\_cluster in ansible.

I’ve created valid task definitions and services for said cluster, but I am am struggling to attach an ec2\_asg to it. Thus not allowing the cluster to create and manage new tasks.

Please find the code for my current progress on this stack overflow link:

[https://stackoverflow.com/questions/61482430/ansible-how-do-you-link-an-ec2-asg-to-a-ecs-cluster](https://stackoverflow.com/questions/61482430/ansible-how-do-you-link-an-ec2-asg-to-a-ecs-cluster)

Is there something obvious I’m missing in the playbook documentation?

Or am I going to need to affect the instances created by the auto scaling group in some way, as to attach them to the cluster instead?

Thanks in advance for any help.
