All Questions
Tagged with amazon-ec2 terraform
747 questions
-1
votes
1
answer
47
views
How to attach an Elastic IP to an EC2 instance in Terraform [closed]
I am trying to attach an EIP to an EC2 instance that is being deployed with Terraform. The stack has a launch template resource which is defining the instance and also a auto scaling group resource.
I ...
0
votes
1
answer
72
views
AWS Auto Scaling Group Stuck in 'Updating Capacity' During Scale-In
I’m using ECS Managed Auto Scaling with Target Tracking.
When the Target Tracking service performs a scale-out action, everything works as expected: the Auto Scaling Group (ASG) launches new instances ...
0
votes
1
answer
39
views
Can I reference snapshot_id from ebs_block_device?
I am creating AMIs from existing EC2 instance, that has 2 ebs volumes. I am using “aws_ami_from_instance”, but then the disk snapshots do not have tags. I found a way from hashi’s github to tag ‘...
1
vote
0
answers
54
views
Unable to create EKS Cluster with Terraform [ Instances failed to join the Kubernetes cluster ]
Terraform code below
provider "aws" {
region = "us-west-2"
}
resource "aws_eks_cluster" "example" {
name = "example-cluster"
role_arn = ...
2
votes
1
answer
38
views
Interating with for_each, need a modified subnet list for each iteration
I have a for_each loop in which I pass a subnet list to a module for creating AWS ASGs.
I'd like the subnet list to be different for each iteration in order to assure that each ASG runs on different ...
-2
votes
1
answer
45
views
Terraform Amazon Machine Image script
I am deploying Amazon Linux 2023 with Terraform. I would like to automate the installation of Kubernetes and Helm so that I can restart my VM and have all the pieces up and running. The following code ...
0
votes
0
answers
39
views
AWS ECS EC2 with CodeDeploy: Task Placement Failure During Blue/Green Deployment
I'm working on a Terraform infrastructure using ECS EC2, ECR, and CodeDeploy for zero-downtime deployments. Here's my current setup and issue:
Current Setup:
ECS cluster running on EC2 instances
Using ...
0
votes
1
answer
283
views
How to Manage Terraform State Across Multiple Workspaces and Environments Without Causing Downtime in AWS?
I've been working on a complex Terraform setup where:
We have multiple environments (e.g., dev, staging, and prod), each using different workspaces.
Each workspace has its own state file and backend ...
0
votes
0
answers
61
views
Unexpected "unsupported block type" error when creating AWS EC2 Spot instance with terraform
I'm trying to create EC2 Spot instance with terraform.
Following instruction of official document, I wrote following code.
resource "aws_instance" "my_spot_instance" {
ami ...
0
votes
1
answer
119
views
Launching EC2 in UI vs Terraform, Not Authorized
I'm in class trying to spin up a VPC with 2 EC2 instances. Instead of doing it via the UI, I set up all the instances using Terraform. The problem is, I am able to spin up instances using the UI, but ...
1
vote
0
answers
38
views
Terraform - can't connect to ec2
I have following terraform code that creates ec2 instance in eu-north-1 and transform traffic from port 8080 to port 8080
provider "aws" {
region = "eu-north-1"
}
resource "...
4
votes
1
answer
554
views
How to use a blue/green deployment style with CodeDeploy and Auto Scaling Groups that allows for repetitive deployments in Terraform?
I have a load-balanced EC2 instance that hosts a web API that I am trying to use AWS CodeDeploy to deploy new versions of the API with. I am trying to make use of a blue/green deployment style, where ...
0
votes
0
answers
57
views
Terraform + Github Workflow
I am using EC2 instances for hosting my nodejs web application which is in a private github repo. I want to make this autoscaling so I moved user_data script to a aws_launch_configuration.
My question ...
1
vote
1
answer
349
views
EC2 Instance with persistent SSH Host Keys using Terraform
I am creating an ec2 instance for usage as a bastion host, using terraform. The instance is reached via an elastic ip. I deploy ssh-keys to the bastion host using a shell script inside the user_data ...
0
votes
0
answers
176
views
AWS: ssh: handshake failed: ssh: unable to │ authenticate, attempted methods [none publickey], no supported methods remain
I'm new to AWS- trying to deploy-wordpress-2-tier-aws-architecture-with-terraform getting error in remote-exec provisioner error ssh: handshake failed: ssh: unable to │ authenticate, attempted ...