Consistent naming makes infrastructure easier to understand and manage.

General Principles

  • Be descriptive - Names should indicate purpose
  • Be consistent - Use the same pattern everywhere
  • Be concise - Keep names readable but not too long
  • Include context - Environment, region, purpose
{environment}-{application}-{component}-{region}

Examples

ResourceName
VPCprod-webapp-vpc-us-east-1
Security Groupprod-webapp-web-sg
EC2 Instanceprod-webapp-api-01
Lambdaprod-webapp-processor

Environment Prefixes

PrefixEnvironment
devDevelopment
stgStaging
prodProduction

Character Restrictions

Be aware of AWS naming restrictions:

  • Most resources: alphanumeric + hyphens
  • S3 buckets: lowercase, globally unique
  • IAM roles: alphanumeric + +=,.@-_

Module Integration

Pass consistent names to modules:

module "vpc" {
  source = "..."
  name   = "${var.environment}-${var.app_name}-vpc"
}

Next Steps