<blockquote>
<p>Is it possible to declare &quot;a complete production level EKS with other aws services&quot; using terraform?</p>
</blockquote>
<p>Yes, and that is what many larger organizations do. I have implemented Kubernetes with other AWS resources this way for larger companies e.g. a bank, using Terraform.</p>
<blockquote>
<p>I want to learn aws by experimenting. But I cannot afford spending that much money. So I need to be able to destroy everything and recreate the exact infrastructure whenever it's needed.</p>
</blockquote>
<p>That should go well. You can use e.g. <code>terraform apply</code> to provision infrastructure and <code>terraform destroy</code> to take it down. I would also recommend to add tests on your infrastructure using e.g. <a href="https://terratest.gruntwork.io/" rel="nofollow noreferrer">Terratest</a> and perhaps use <a href="https://github.com/tfsec/tfsec" rel="nofollow noreferrer">tfsec</a> in a <em>pipeline</em> so that you are comfortable that new changes does not break your cluster - using <em>Infrastructure as Code</em> the full way.</p>
<blockquote>
<p>Is there a reliable way of declaring everything once and recreate the whole infrastructure declaratively (without touching aws console)?</p>
</blockquote>
<p>Yes, that is a best practice.</p>

CC BY-SA 4.0
2021-01-25T18:43:59.540Z
2021-01-25T18:43:59.540Z
Jonas
<p>Is it possible to declare &quot;a complete production level EKS with other aws services&quot; using terraform? I know that terraform has <a href="https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest" rel="nofollow noreferrer">an eks module</a> and <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs" rel="nofollow noreferrer">an aws provider</a>. But I'm not sure if one can create everything (ALB, IAM roles and policies, security groups, ebs, efs, rds, aws networking, ...) using terraform.</p>
<p>I want to learn aws by experimenting. But I cannot afford spending that much money. So I need to be able to destroy everything and recreate the exact infrastructure whenever it's needed.</p>
<p>I've found a really good <a href="https://www.eksworkshop.com/" rel="nofollow noreferrer">aws workshop</a>. But like almost all of tutorials, it's based on running &quot;eksctl and aws cli&quot; commands.</p>
<p>Is there a reliable way of declaring everything once and recreate the whole infrastructure declarativly (without touching aws console)?</p>

CC BY-SA 4.0
2021-01-23T17:56:31.330Z
It's definitely possible, but I think the question is would you use Terraform to create the ALB and the Kubernetes namespaces / roles / service accounts using the Kubernetes provider. Or would you let Kubernetes manage the creation of AWS resources e.g. volumes, ALB via the AWS EBS CSI or CNI. There is a tradeoff on what you would want Terraform to manage and what AWS resources you would like Kubernetes to manage as part of application service deployment. It is also worth noting that sometimes Terraform can be behind the cloud provider APIs in terms of features.
Robert
<amazon-web-services><terraform><amazon-ec2><infrastructure-as-code><eks>
Is it possible to have an aws EKS infrastructure as code?
HsnVahedi
# Is it possible to have an aws EKS infrastructure as code?

(Asked by: username_0 on 2021-01-22)

Is it possible to declare "a complete production level EKS with other aws services" using terraform? I know that terraform has [an eks module](https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest) and [an aws provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs). But I'm not sure if one can create everything (ALB, IAM roles and policies, security groups, ebs, efs, rds, aws networking, ...) using terraform.

I want to learn aws by experimenting. But I cannot afford spending that much money. So I need to be able to destroy everything and recreate the exact infrastructure whenever it's needed.

I've found a really good [aws workshop](https://www.eksworkshop.com/). But like almost all of tutorials, it's based on running "eksctl and aws cli" commands.

Is there a reliable way of declaring everything once and recreate the whole infrastructure declarativly (without touching aws console)?

**Tags:** amazon-web-services, terraform, amazon-ec2, infrastructure-as-code, eks

> **Comments:**
> **username_1**: It's definitely possible, but I think the question is would you use Terraform to create the ALB and the Kubernetes namespaces / roles / service accounts using the Kubernetes provider. Or would you let Kubernetes manage the creation of AWS resources e.g. volumes, ALB via the AWS EBS CSI or CNI. There is a tradeoff on what you would want Terraform to manage and what AWS resources you would like Kubernetes to manage as part of application service deployment. It is also worth noting that sometimes Terraform can be behind the cloud provider APIs in terms of features.  

---

## 1 answers

### Answer by username_2 on 2021-01-25. Score: 3 | Accepted answer

> Is it possible to declare "a complete production level EKS with other aws services" using terraform?

Yes, and that is what many larger organizations do. I have implemented Kubernetes with other AWS resources this way for larger companies e.g. a bank, using Terraform.

> I want to learn aws by experimenting. But I cannot afford spending that much money. So I need to be able to destroy everything and recreate the exact infrastructure whenever it's needed.

That should go well. You can use e.g. `terraform apply` to provision infrastructure and `terraform destroy` to take it down. I would also recommend to add tests on your infrastructure using e.g. [Terratest](https://terratest.gruntwork.io/) and perhaps use [tfsec](https://github.com/tfsec/tfsec) in a *pipeline* so that you are comfortable that new changes does not break your cluster - using *Infrastructure as Code* the full way.

> Is there a reliable way of declaring everything once and recreate the whole infrastructure declaratively (without touching aws console)?

Yes, that is a best practice.


---

