At AWS re:Invent? Bring your audit questions to Anton Babenko.Meet Anton at AWS re:InventAsk for a time
Sign in
Menu
Start free
Annex H: NIS2

NIS2 controls built into your Terraform modules. Enforced before apply.

Article 21 asks for technical measures for cryptography, access control, incident handling and network security. The modules enforce these controls before apply and list the section of the NIS2 implementing regulation each one maps to, where the catalog names one.

Modules enforce 53 of 101 NIS2 controls in the catalog. Of the 76 that cite a NIS2 clause, they enforce 36. The controls they do not enforce stay with your team, with risk policies, incident reporting, supply chain assessments and training.

No credit card or AWS account needed to start. By Anton Babenko, maintainer of terraform-aws-modules, more than 2 billion provisions.

Annex H: NIS2

Framework
NIS2 Directive (EU 2022/2555)
For
Your team, on Terraform
H.1

Scope for NIS2

NIS2 applies to essential and important entities operating in the EU, in sectors such as energy, transport, healthcare, digital infrastructure and ICT services.

H.1.1

Covers

  • Infrastructure controls on AWS resources that map to sections of the NIS2 implementing regulation, by section in H.3.
  • terraform-aws-modules through the NIS2 framework host or your org endpoint. Once your team switches to the compliance.tf provider, resources written by hand outside modules are checked against its built-in CIS controls, not the NIS2 set.
H.1.2

Stays with your team

  • Risk analysis and information system security policies (Art. 21(2)(a)).
  • Incident handling and reporting to CSIRTs (Art. 21(2)(b), Art. 23).
  • Business continuity and crisis management beyond backup configuration (Art. 21(2)(c)).
  • Supply chain security assessments (Art. 21(2)(d)).
  • Cybersecurity training and basic cyber hygiene (Art. 21(2)(g)).
  • Human resources security and access control policies (Art. 21(2)(i)).
  • Registration with national competent authorities (Art. 3).
  • Resources outside compliance.tf module coverage, and every control H.4 lists as Mapped: 40 with a NIS2 clause and 8 without one.
H.2

The source line

Point a module at the NIS2 framework host. Same inputs and outputs, no state migration. Terraform 1.0 or later.

-  source  = "terraform-aws-modules/s3-bucket/aws"
+  source  = "nis2.compliance.tf/terraform-aws-modules/s3-bucket/aws"
   version = "~> 5.0"

With an org endpoint, the source names your org host instead, and NIS2 comes from your org's configuration.

H.3

Enforced and mapped, by section

Of the 76 NIS2 controls in the documented catalog that cite a clause, modules enforce 36. A control appears once under each section it maps to.

3 Incident handling18 of 32
11 Access control11 of 23
9 Cryptography4 of 20
6 Security in network and information systems acquisition, development and maintenance6 of 13
4 Business continuity and crisis management4 of 8
1 Policy on the security of network and information systems2 of 5
12 Asset management2 of 2
5 Supply chain security0 of 2

The catalog maps 25 more controls to NIS2 without naming a clause, 17 of them enforced. They are listed apart at the end of H.4 and left out of these counts.

Every row is a control your auditor can look up.

Filter the register, or search by control name or clause, for example Cryptography.

76 of 76 shown

Each control links to its public docs page.

Enforced
Modules set this control before anything is deployed.
Mapped
Documented on its docs page, not set by modules. Your team owns it.
H.4

Control register

ControlStatusNIS2 clauses
ACM RSA certificates should use a key length of at least 2,048 bitsEnforced9 Cryptography
ACM certificates should have transparency logging enabledEnforced3 Incident handling, 9 Cryptography
AppSync GraphQL APIs should have field-level logging enabledEnforced3 Incident handling
CloudFront distributions access logs should be enabledEnforced3 Incident handling
CloudWatch log groups should have retention period of at least 365 daysEnforced1 Policy on the security of network and information systems, 3 Incident handling, 4 Business continuity and crisis management
EC2 instances should have detailed monitoring enabledEnforced3 Incident handling
EC2 instances should have IAM profile attachedEnforced11 Access control
EC2 instances should use IMDSv2Enforced6 Security in network and information systems acquisition, development and maintenance
EC2 launch templates should not assign public IPs to network interfacesEnforced3 Incident handling
EFS access points should enforce a root directoryEnforced11 Access control
EKS clusters should have control plane audit logging enabledEnforced3 Incident handling, 12 Asset management
ElastiCache for Redis replication groups should be encrypted in transitEnforced9 Cryptography
ELB application and classic load balancer logging should be enabledEnforced3 Incident handling
FSx for Lustre file systems should be configured to copy tags to backupsEnforced3 Incident handling, 4 Business continuity and crisis management, 11 Access control
API Gateway V2 stages should have access logging configuredEnforced3 Incident handling, 11 Access control
KMS CMK rotation should be enabledEnforced11 Access control
MSK clusters should require TLS for client-broker connectionsEnforced6 Security in network and information systems acquisition, development and maintenance
Network Firewall firewalls should have deletion protection enabledEnforced6 Security in network and information systems acquisition, development and maintenance
Network Firewall policies should have default stateless action set to drop or forward for fragmented packetsEnforced6 Security in network and information systems acquisition, development and maintenance
Network Firewall policies should have default stateless action set to drop or forward for full packetsEnforced6 Security in network and information systems acquisition, development and maintenance
OpenSearch domains should have audit logging enabledEnforced3 Incident handling
OpenSearch domains should have Cognito authentication enabled for KibanaEnforced11 Access control
OpenSearch domains should have logging to CloudWatch Logs enabledEnforced3 Incident handling
RDS Aurora clusters should have backtracking enabledEnforced4 Business continuity and crisis management
RDS DB clusters should be configured to copy tags to snapshotsEnforced11 Access control
RDS DB clusters should have IAM authentication configuredEnforced11 Access control
RDS DB instances and clusters should have enhanced monitoring enabledEnforced3 Incident handling
RDS DB instance backup should be enabledEnforced3 Incident handling, 4 Business continuity and crisis management
RDS DB instances should be integrated with CloudWatch logsEnforced3 Incident handling
RDS DB instances should be configured to copy tags to snapshotsEnforced11 Access control
RDS DB instances should have iam authentication enabledEnforced11 Access control
Redshift clusters should have audit logging enabledEnforced3 Incident handling
Redshift cluster encryption in transit should be enabledEnforced6 Security in network and information systems acquisition, development and maintenance, 9 Cryptography
S3 buckets should have lifecycle policies configuredEnforced12 Asset management
S3 buckets should have logging enabledEnforced1 Policy on the security of network and information systems, 3 Incident handling, 11 Access control
Step Functions state machines should have logging enabledEnforced3 Incident handling
API Gateway REST API stages should have a client certificate configuredMapped11 Access control
API Gateway stages should have logging enabledMapped3 Incident handling
AppStream fleets should have idle disconnect timeout set to 10 minutes or lessMapped11 Access control
AppStream fleets should limit maximum user duration to 10 hours or lessMapped11 Access control
AppStream fleets should have session disconnect timeout set to 5 minutes or lessMapped11 Access control
Athena workgroups should be encrypted at restMapped9 Cryptography
Athena workgroups should have logging enabledMapped3 Incident handling
CloudTrail trails should be integrated with CloudWatch logsMapped3 Incident handling
CloudTrail trails should have logs encrypted using a customer managed KMS keyMapped9 Cryptography
CloudTrail trails should have log file validation enabledMapped3 Incident handling
CodeBuild projects should have logging enabledMapped3 Incident handling, 6 Security in network and information systems acquisition, development and maintenance
CodeBuild projects should have S3 logs encryptedMapped3 Incident handling, 5 Supply chain security, 6 Security in network and information systems acquisition, development and maintenance, 9 Cryptography
CodeBuild report group exports should be encrypted at restMapped5 Supply chain security, 6 Security in network and information systems acquisition, development and maintenance, 9 Cryptography
Cognito identity pools should not allow unauthenticated identitiesMapped11 Access control
DynamoDB Accelerator (DAX) clusters should be encrypted at restMapped9 Cryptography
DynamoDB Accelerator clusters should be encrypted in transitMapped6 Security in network and information systems acquisition, development and maintenance, 9 Cryptography
DMS endpoints for Redis OSS should have TLS enabledMapped9 Cryptography
DocumentDB clusters should have an adequate backup retention periodMapped3 Incident handling, 4 Business continuity and crisis management
EC2 Client VPN endpoints should have client connection logging enabledMapped3 Incident handling
EFS access points should enforce a user identityMapped11 Access control
Elasticsearch domains should have audit logging enabledMapped3 Incident handling
Elasticsearch domains should have cognito authentication enabledMapped11 Access control
Glue jobs CloudWatch logs encryption should be enabledMapped3 Incident handling
IAM password policies should have minimum length set to 14 or greaterMapped9 Cryptography
IAM password policies should require at least one lowercase letterMapped9 Cryptography, 11 Access control
IAM password policies should require at least one numberMapped9 Cryptography
IAM password policies should require at least one symbolMapped9 Cryptography
IAM password policies should require at least one uppercase letterMapped9 Cryptography
IAM password policies should prevent password reuseMapped9 Cryptography
IAM password policies should expire passwords within 90 days or lessMapped1 Policy on the security of network and information systems, 9 Cryptography, 11 Access control
Kinesis streams should have an adequate data retention periodMapped1 Policy on the security of network and information systems, 4 Business continuity and crisis management
MQ brokers should have audit log streaming to CloudWatch enabledMapped3 Incident handling
MSK Connect connectors should be encrypted in transitMapped6 Security in network and information systems acquisition, development and maintenance, 9 Cryptography
Neptune DB clusters should publish audit logs to CloudWatch LogsMapped3 Incident handling
Neptune DB clusters should have automated backups enabledMapped3 Incident handling, 4 Business continuity and crisis management
Neptune DB clusters should be configured to copy tags to snapshotsMapped11 Access control
Neptune DB clusters should have IAM database authentication enabledMapped11 Access control
Route 53 domains should have privacy protection enabledMapped1 Policy on the security of network and information systems, 3 Incident handling, 4 Business continuity and crisis management, 6 Security in network and information systems acquisition, development and maintenance, 9 Cryptography
S3 buckets should have MFA delete enabledMapped11 Access control
SageMaker models should have network isolation enabledMapped6 Security in network and information systems acquisition, development and maintenance

Enforced or mapped without a named NIS2 clause

The catalog lists these 25 controls under NIS2 but names no NIS2 clause for them, so the register and the counts in H.3 leave them out. Each still links to its docs page.

ControlStatus
CloudFront distributions should require encryption in transitEnforced
DMS endpoints for MongoDB should have an authentication mechanism enabledEnforced
EC2 launch templates should use Instance Metadata Service Version 2 (IMDSv2)Enforced
ElastiCache Redis clusters should have automatic backups enabled with a retention period of 15 days or greaterEnforced
ELB network load balancers should have TLS listener security policy configuredEnforced
FSx for OpenZFS file systems should be configured to copy tags to backups and volumesEnforced
Aurora PostgreSQL DB clusters should publish logs to CloudWatch LogsEnforced
RDS DB instances backup retention period should be greater than or equal to 7Enforced
RDS DB instances should have logging enabledEnforced
RDS for MariaDB DB instances should publish logs to CloudWatch LogsEnforced
RDS for PostgreSQL DB instances should publish logs to CloudWatch LogsEnforced
RDS for SQL Server DB instances should publish logs to CloudWatch LogsEnforced
Redshift clusters should have audit logging and encryption enabledEnforced
S3 buckets should have default encryption enabled using KMSEnforced
S3 buckets with versioning enabled should have lifecycle policies configuredEnforced
VPC security groups should restrict ingress from 0.0.0.0/0 or ::/0 to cassandra ports 7199 or 9160 or 8888Enforced
WAFv2 rules should have CloudWatch metrics enabledEnforced
API Gateway stages should have cache encryption at rest enabledMapped
CloudTrail trails should have at least one enabled trail present in a regionMapped
DataSync tasks should have logging enabledMapped
Elasticsearch domain should send logs to CloudWatchMapped
Glue jobs bookmarks encryption should be enabledMapped
IAM password policies should have strong configurations with minimum length of 8 or greaterMapped
IAM password policies should have strong configurationsMapped
S3 buckets should have object logging enabledMapped

Clause IDs for the auditor. Your stack stays as it is.

Compliance.tf works alongside your scanners, plan policy, CSPM and GRC tool. It sets the controls in the modules and lists the clause each one is there for.

H.5

Evidence

H.5.1

What compliance.tf gives your auditor

  • The NIS2 clause IDs behind each enforced setting, with stable control IDs and public docs pages.
  • The config snapshot bound to each environment, and the per-action audit log of promotions between environments.
H.5.2

What comes from your AWS account and GRC tool

Evidence of what actually runs comes from your own account, for example AWS Config and your CSPM. Your GRC tool keeps tracking policies and audit workflows.

H.6

Plans for NIS2

NIS2 is in the 30-day trial and in Full Access, $1,000 a year on AWS Marketplace. Schedule of fees.

H.7

Questions about NIS2

H.7.1

Which NIS2 requirements does this cover?

Compliance.tf enforces the technical cybersecurity measures from Article 21(2): cryptography and encryption (Art. 21(2)(h)), access control (Art. 21(2)(i)), logging and incident detection (Art. 21(2)(b)), and backup/business continuity infrastructure (Art. 21(2)(c)). These are the requirements that translate directly to AWS resource configuration. The control register groups controls by the sections of the NIS2 implementing regulation, for example 9 Cryptography, not by these Art. 21(2) letters.

H.7.2

Does NIS2 apply to my organisation?

NIS2 applies to entities in 18 critical sectors operating in the EU. Essential entities include energy, transport, banking, health, digital infrastructure, and public administration. Important entities include postal services, waste management, manufacturing, food, chemicals, and digital providers. If you have 50 or more employees or EUR 10 million or more in turnover and operate in a covered sector, NIS2 likely applies.

H.7.3

Can I adopt this gradually, or is it all-or-nothing?

Fully incremental. Start with one module in one environment. Your existing modules continue working untouched. If you use Terragrunt or Terramate to orchestrate your runs, nothing changes - you're only swapping the module source line. There is no global policy agent to deploy, no wrapper binary, no sidecar. Each module source line is independent.

H.7.4

What if we want to switch back?

Each module keeps the inputs and outputs of its terraform-aws-modules counterpart and needs no state migration, so switching back is the same source line change in reverse.