<p>Is there a reason why you are trying to monitor it from the outside? Can an autoscaling group with a load balancer be a solution. If yes, then provisioning these resources, having the ability to track &amp; update configuration is something that will be possible using a tool like terraform(multi-cloud support) or cloudformation(cloud-specific).
Ansible might also be an alternative though it brings its fare share of pros &amp; cons being stateless and relying on the actual cloud resources for tracking deviations</p>

CC BY-SA 4.0
2020-06-23T08:16:54.513Z
2020-06-23T08:16:54.513Z
Mikhail Advani
<p>TL;DR; Terraform does allow you to get a lot of what you want done.</p>
<p>Also, you might benefit from a more managed solution like AWS Fargate (which you also declare with Terraform).</p>
<blockquote>
<p>Whenever I use search keywords such as &quot;orchestration&quot; or &quot;server clusters&quot; or &quot;iaas&quot; I'll always end up in hundreds of results that are going to talk about containers only.</p>
</blockquote>
<p>That is because containers and serverless are the way of the future and most of us are moving our legacy workloads to those technologies. You should try and avoid starting new projects with an EC2 deployment pattern. In particular if you don't have the skillset to manage it all or the money to waste.</p>
<blockquote>
<p>My case is to be able to deploy, scale and monitor VM instances such as DO's droplets or AWS' EC2s.</p>
</blockquote>
<p>Amazon provides auto scaling groups that allow to scale out EC2 instances.</p>
<p>For monitoring, you either use basic metrics (CPU, Network, etc) or you install an agent to monitor system internals (RAM and other application specific data).
The installation of the agent (either a vendor like Datadog or AWS CloudWatch) is usually done through the instance's &quot;User Data&quot;.</p>
<p>Terraform allows you to pass &quot;User Data&quot; scripts to your instances and has a nice templating syntax.</p>
<blockquote>
<p>Currently I'm using a CD tool that will use Ansible to spawn (using just REST API) and provision newly created machines. Although neither of these two tools will have capability to monitor created instances, check up on their resources usage, scale them on demand or map them with respective HTTP endpoints (assume 1 VM hosts n webservices).</p>
</blockquote>
<p>Correct, as mentioned before Ansible is not the right tool for the job. I would say it is terrible in the space. The main aspect is the lack of state tracking and the fact that it is procedural instead of declarative (this is how I want something done vs this is what I want my end state to be go figure it out).</p>
<blockquote>
<p>So to assist CD+Ansible in their jobs I need custom tools that would: keep track of number of instances, their status, DNS server, integration with ingress loadbalancer (haproxy) to keep track of which servers are up and when, what are the IP addresses and/or networks of the newly created droplets and more.</p>
</blockquote>
<p>If you are using an AutoScaling group, which seems to be what you are suggesting, you don't track individual instances. You define your minimum, maximum and your scaling criteria. Terraform can definitely declare and deploy the autoscaling group.</p>
<p>The autoscaling group allows you to define health checks to kill instances.</p>
<p>If you are in the autoscaling space you don't want to have individual DNS records for your instances (though for service discovery with HAProxy you might need to do SRV records or integrate with Cloud Map).
Also, if you change load balancer technologies AWS ALB allows you to attach your instances to a target group without you having to do anything.</p>
<p>Both an AWS ALB or HAProxy would also make use of health checks so your orchestration tool doesn't need to know about the health of the instances.</p>
<blockquote>
<p>I don't quite understand if terraform is even helpful in this case. From what I understood it'll merely help me with spawning a new droplet which I can as well do with single HTTP request. If I want to have more I need to go with paid cloud?</p>
</blockquote>
<p>We have thousands of instances and containers, hundreds of ALBs and a handful of lambdas all managed with Terraform. We let Fargate and other tools manage the blue/green aspects of the deployment process but Terraform defines the infra we want.</p>
<blockquote>
<p>What would be a helpful stack to aid my case?</p>
</blockquote>
<p>Move to containers, use AWS Fargate so you don't have to manage the orchestration aspects of your autoscaling, health checks, rollbacks, etc.</p>
<p>Drop Ansible, it is not the right tool for this job. Definitely give Terraform a try.</p>

CC BY-SA 4.0
2020-06-30T06:36:02.287Z
2020-06-30T06:36:02.287Z
DavidGamba
<p>Whenever I use search keywords such as &quot;orchestration&quot; or &quot;server clusters&quot; or &quot;iaas&quot; I'll always end up in hundreds of results that are going to talk about containers only.</p>
<p>My case is to be able to deploy, scale and monitor VM instances such as DO's droplets or AWS' EC2s. Currently I'm using a CD tool that will use Ansible to spawn (using just REST API) and provision newly created machines. Although neither of these two tools will have capability to monitor created instances, check up on their resources usage, scale them on demand or map them with respective HTTP endpoints (assume 1 VM hosts n webservices). So to assist CD+Ansible in their jobs I need custom tools that would: keep track of number of instances, their status, DNS server, integration with ingress loadbalancer (haproxy) to keep track of which servers are up and when, what are the IP addresses and/or networks of the newly created droplets and more.</p>
<p>I don't quite understand if terraform is even helpful in this case. From what I understood it'll merely help me with spawning a new droplet which I can as well do with single HTTP request. If I want to have more I need to go with paid cloud?</p>
<p>What would be a helpful stack to aid my case?</p>

<ansible><amazon-ec2><orchestration>
A tool to orchestrate cloud server (virtual machine) instances
Mike
# A tool to orchestrate cloud server (virtual machine) instances

(Asked by: username_0 on 2020-06-22)

Whenever I use search keywords such as "orchestration" or "server clusters" or "iaas" I'll always end up in hundreds of results that are going to talk about containers only.

My case is to be able to deploy, scale and monitor VM instances such as DO's droplets or AWS' EC2s. Currently I'm using a CD tool that will use Ansible to spawn (using just REST API) and provision newly created machines. Although neither of these two tools will have capability to monitor created instances, check up on their resources usage, scale them on demand or map them with respective HTTP endpoints (assume 1 VM hosts n webservices). So to assist CD+Ansible in their jobs I need custom tools that would: keep track of number of instances, their status, DNS server, integration with ingress loadbalancer (haproxy) to keep track of which servers are up and when, what are the IP addresses and/or networks of the newly created droplets and more.

I don't quite understand if terraform is even helpful in this case. From what I understood it'll merely help me with spawning a new droplet which I can as well do with single HTTP request. If I want to have more I need to go with paid cloud?

What would be a helpful stack to aid my case?

**Tags:** ansible, amazon-ec2, orchestration


---

## 2 answers

### Answer by username_1 on 2020-06-23. Score: 3

Is there a reason why you are trying to monitor it from the outside? Can an autoscaling group with a load balancer be a solution. If yes, then provisioning these resources, having the ability to track & update configuration is something that will be possible using a tool like terraform(multi-cloud support) or cloudformation(cloud-specific).
Ansible might also be an alternative though it brings its fare share of pros & cons being stateless and relying on the actual cloud resources for tracking deviations


---

### Answer by username_2 on 2020-06-30. Score: 2

TL;DR; Terraform does allow you to get a lot of what you want done.

Also, you might benefit from a more managed solution like AWS Fargate (which you also declare with Terraform).

> Whenever I use search keywords such as "orchestration" or "server clusters" or "iaas" I'll always end up in hundreds of results that are going to talk about containers only.

That is because containers and serverless are the way of the future and most of us are moving our legacy workloads to those technologies. You should try and avoid starting new projects with an EC2 deployment pattern. In particular if you don't have the skillset to manage it all or the money to waste.

> My case is to be able to deploy, scale and monitor VM instances such as DO's droplets or AWS' EC2s.

Amazon provides auto scaling groups that allow to scale out EC2 instances.

For monitoring, you either use basic metrics (CPU, Network, etc) or you install an agent to monitor system internals (RAM and other application specific data).
The installation of the agent (either a vendor like Datadog or AWS CloudWatch) is usually done through the instance's "User Data".

Terraform allows you to pass "User Data" scripts to your instances and has a nice templating syntax.

> Currently I'm using a CD tool that will use Ansible to spawn (using just REST API) and provision newly created machines. Although neither of these two tools will have capability to monitor created instances, check up on their resources usage, scale them on demand or map them with respective HTTP endpoints (assume 1 VM hosts n webservices).

Correct, as mentioned before Ansible is not the right tool for the job. I would say it is terrible in the space. The main aspect is the lack of state tracking and the fact that it is procedural instead of declarative (this is how I want something done vs this is what I want my end state to be go figure it out).

> So to assist CD+Ansible in their jobs I need custom tools that would: keep track of number of instances, their status, DNS server, integration with ingress loadbalancer (haproxy) to keep track of which servers are up and when, what are the IP addresses and/or networks of the newly created droplets and more.

If you are using an AutoScaling group, which seems to be what you are suggesting, you don't track individual instances. You define your minimum, maximum and your scaling criteria. Terraform can definitely declare and deploy the autoscaling group.

The autoscaling group allows you to define health checks to kill instances.

If you are in the autoscaling space you don't want to have individual DNS records for your instances (though for service discovery with HAProxy you might need to do SRV records or integrate with Cloud Map).
Also, if you change load balancer technologies AWS ALB allows you to attach your instances to a target group without you having to do anything.

Both an AWS ALB or HAProxy would also make use of health checks so your orchestration tool doesn't need to know about the health of the instances.

> I don't quite understand if terraform is even helpful in this case. From what I understood it'll merely help me with spawning a new droplet which I can as well do with single HTTP request. If I want to have more I need to go with paid cloud?

We have thousands of instances and containers, hundreds of ALBs and a handful of lambdas all managed with Terraform. We let Fargate and other tools manage the blue/green aspects of the deployment process but Terraform defines the infra we want.

> What would be a helpful stack to aid my case?

Move to containers, use AWS Fargate so you don't have to manage the orchestration aspects of your autoscaling, health checks, rollbacks, etc.

Drop Ansible, it is not the right tool for this job. Definitely give Terraform a try.


---

