terraform-aws-modules / terraform-aws-ec2-instance

Terraform module to create AWS EC2 instance(s) resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/ec2-instance/aws
Apache License 2.0
758 stars 1.88k forks source link

Access to metadata service returns 401 unauthorized #387

Closed lmilbaum closed 7 months ago

lmilbaum commented 7 months ago

Description

The module source code tracked here - terraform-test-environment-module

Running the following command from within the instance returns 401 unauthorized curl http://169.254.169.254/latest/meta-data

Versions

Reproduction Code [Required]

Steps to reproduce the behavior:

Expected behavior

Actual behavior

Terminal Output Screenshot(s)

Additional context

cgwalters commented 7 months ago

It's likely because IMDSv2 is enabled in the base image.

Why are you trying to fetch from the metadata service directly versus using cloud-init to execute scripts?

antonbabenko commented 7 months ago

Closing this issue here since it is not related to this module.

lmilbaum commented 7 months ago

It's likely because IMDSv2 is enabled in the base image.

Why are you trying to fetch from the metadata service directly versus using cloud-init to execute scripts? It is needed for running an external wait command until the user data script run completes

github-actions[bot] commented 6 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.