For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/terraform-aws-elasticsearch-without-iam-authentication.md.
A documentation index is available at /llms.txt.
AWS Elasticsearch domains should enforce IAM authentication to restrict access to authorized users only. Without proper IAM policies—such as using "Principal": "*" in the aws_elasticsearch_domain_policy resource—unauthorized users could gain access to sensitive data by connecting from approved IP addresses. To mitigate this risk, the Principal field should be set to reference specific IAM principals, as shown below: