/terraform-basic-aws-setup

A basic aws setup using terraform. The code would create a new vpc and set up instances with autoscaling.

Primary LanguageHCL

terraform-basic-aws-setup

A basic aws setup using terraform. The code would create a new vpc and set up instances with autoscaling. The vpc consists of two private subnets and a public subnet. The public subnet would run a buildmaster which would run an http/https proxy( Tiny proxy in this case) for the instances in the pivate subnet to perform initial bootstrapping. The security groups for the buildmaster is configured to allow access to the proxy only to the instances in the private subnet. A mysql instance, elastic cache cluster( Memcached) and load-balancer are created in the private subnet with security groups appropriately configured. An s3 bucket and a cloudfront distribution( with the s3 bucket as origin) are created and an instance profile is attached to the buildmaster that allows it access to the s3 bucket and to create invalidation requests for the cloudfront distribution.

Note: The code uses t2.micro istances for the launch-configuration for asg and has scaling policies that rely on the CPU utilization provided by cloudwatch. NEVER use t2 class instaces with a CPU utilization based auto-scaling policy in production.