Guided Walkthroughs

Configuration Packages

By Implementation

Service Control PoliciesConfig RulesAuto Remediation RulesConformance PacksAmazon GuardDutyAmazon InspectorAWS Security HubAWS Network FirewallRoute53 Resolver SecurityAmazon MacieS3 Bucket PoliciesCloudWatch Alarms and Event RulesAWS WAFAWS Secrets ManagerAWS Systems ManagerSecurity Groups & NACLsAWS KMSAWS SSOIAM PoliciesVPC Endpoint PoliciesCloudFormation Guard RulesLoad BalancersRDS Event SubscriptionsAWS Resource Access Manager (RAM)

By Service Protected

Reference Guides

Other

CloudFormation Guard Rules

Cloudformation Guard Rules for Amazon EKS

CloudFormation guard rules template for Amazon EKS resources

The following rules are included: 

  • Control Plane Public Access Disabled
  • Control Plane Public Access is Restricted
  • Kubernetes Secrets are Encrypted with KMS
  • Control Plane Logging Enabled
CloudFormation Validation Tool: Syntax and Security validation for your templates online

let eks_clusters = Resources.*[
	Type == "AWS::EKS::Cluster"
]

rule eks_private_only when %eks_clusters !empty {
	%eks_clusters {
		Properties {
			ResourcesVpcConfig exists <<ResourcesVpcConfig is not configured. (Public access is enabled by default.)>>
			when ResourcesVpcConfig exists {
				ResourcesVpcConfig {
					EndpointPublicAccess exists <<EndpointPublicAccess is not configured. (enabled by default.)>>
					when EndpointPublicAccess exists {
						EndpointPublicAccess == false <<Public access is enabled.>>
					}
				}
			}
		}
	}
}

rule eks_control_plane_public_access_restricted when %eks_clusters !empty {
	%eks_clusters {
		Properties {
			ResourcesVpcConfig exists <<ResourcesVpcConfig is not configured. (Public access is enabled by default.)>>
			when ResourcesVpcConfig exists {
				ResourcesVpcConfig {
					EndpointPublicAccess exists <<EndpointPublicAccess is not configured. (enabled by default.)>>
					when EndpointPublicAccess exists {
						EndpointPublicAccess == false <<Public access is enabled.>> OR
						EndpointPublicAccess == true
						when EndpointPublicAccess == true {
							PublicAccessCidrs.* {
								this != "0.0.0.0/0" <<Unrestricted public access is enabled.>>
							}
						}
					}
				}
			}
		}
	}
}

rule eks_secrets_encrypted when %eks_clusters !empty {
	%eks_clusters {
		Properties {
			EncryptionConfig exists <<EncryptionConfig is not configured.(Secrets encryption is disabled.)>>
		}
	}
}

rule eks_control_plane_logging when %eks_clusters !empty {
	%eks_clusters {
		Properties {
			Logging exists <<Logging is not configured.>>
			when Logging exists {
				Logging {
					ClusterLogging {
						some EnabledTypes[*].Type == "api" <<Logging is not configured for the API server.>>
						some EnabledTypes[*].Type == "audit" <<Audit logging is not enabled.>>
						some EnabledTypes[*].Type == "authenticator" <<Authenticator logging is not enabled.>>
						some EnabledTypes[*].Type == "controllerManager" <<Controller Manager logging is not enabled.>>
						some EnabledTypes[*].Type == "scheduler" <<Scheduler logging is not enabled.>>
					}
				}
			}
		}
	}
}


Actions



Customize Template

* Required field

Upgrade to Premium for More Features
Sign up

Guided Walkthroughs
Step-by-step configuration wizards for your environment
Dedicated Security Account
AWS Backup Strategy
VPC Connectivity Setup
Automated Patching
All Guides
Configuration Packages
Pre-built packages for common configuration
Common SCPs
CloudFormation Guard Rules
Auto Remediation Rules
IAM Monitoring & Compliance
All Packages
Automated Assessments
  • 350+ security checks
  • Well-architected reviews
  • Detailed compliance reports
  • Remediation templates
  • Email summaries
  • Learn more