Point Cloudflare to ECS instances

689 views
Skip to first unread message

Feifan Zhou

unread,
Nov 24, 2015, 5:25:52 PM11/24/15
to Terraform
Hi all,
I have an ECS setup in Terraform with the underlying EC2 instances being created by an autoscaling group and launch config. Currently, I just have one instance. Is there a way to get the IP address of that instance and pass it in to a Cloudflare DNS record? Alternatively, what would be a good setup to reverse-proxy the ECS cluster and set a Cloudflare record to that? 

The challenge seems to be that Terraform doesn't have visibility to the underlying EC2 clusters, which have their own public IPs. 

Thanks!

Best,
Feifan

Clint Shryock

unread,
Nov 30, 2015, 7:38:08 AM11/30/15
to terrafo...@googlegroups.com
Hey Feifan –

Even at a scale of 1 instance, I imagine the best way to connect your ECS to Cloudflare would be by introducing an ELB into your setup. This way, Cloudflare records shouldn't need to change, and the ELB handles the routing of requests to the specific instance(s) as the exist at that time. 

Does that make sense? Or is there something that prohibits this approach that I'm unaware of?

Regards,
Clint

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/2d9d6b2f-1aac-443a-bc5a-15245219a56c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Clint

Feifan Zhou

unread,
Dec 1, 2015, 10:41:03 PM12/1/15
to Terraform
Hi Clint,
Thanks for your reply. Nothing preventing that, although I'm not particularly familiar with ELB … how would I integrate it into my setup?

Clint Shryock

unread,
Dec 2, 2015, 10:13:29 AM12/2/15
to terrafo...@googlegroups.com
It depends on your setup, I suppose. Essentially you create an ELB, and add your ECS instances to it. You forward the necessary port to the port your services are listening to.

Here's the heavy handed guide from AWS:


Once you have the ELB configured, you can add it to your AutoScaling group's `load_balancers` attribute, which should connect the two.

Sorry I don't have concrete examples for you :(

--
Clint

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Clint
Reply all
Reply to author
Forward
0 new messages