devz-docz

Aggregation of onboarding and general devz standards that I have gatherd over my career.

View on GitHub

AWS / Naming

Naming is one of the hard problems in computing. Naming instances in a shared name space, such as AWS, is especially rife with problems. Often a company uses a single AWS account across multiple projects and so the projects have to negotiate how to share the namespace for resources. There are a number of different axes of belonging I might want to include in the name: to which project does a resource belong, to which environment (dev, prod, staging), which function within the environment. Then there are entities which exist only in terms of their relationship to other objects, e.g. roles associated with a particular lambda function.

Things are further complicated in AWS because there are different uniqueness constraints in play:

Uniqueness constraint Example resources
Global (the entirety of AWS) S3 buckets
Per account IAM resources (users, groups, roles, policies, …)
Per region Most everything else (ALB, ECS, RDS, …)

As with all naming schemes (and other stylistic things such as casing and comments) where the client already has a functional naming scheme I should follow that - there are more important issues to deal with. However, for my own work and for projects where I are setting the standard tend to use the following.

Globally unique

S3 Buckets

${account.alias}-${application.name}[-${environment}][-${region}] - these names begin with a consistent account/usage prefix as they are globally scoped across all of AWS.

e.g.

Unique per account

IAM resources

IAM resource names are account unique (i.e., visible across all regions), e.g. for roles:

${service/realm}[-${role}]-${project/application}-${environment} - is the general form

e.g.

IAM policies

Where the details of an IAM role are in an associated policy (usually the case) they are named after the associated role, but with -policy appended, e.g.

Unique per region

Where the name is scoped by the resource type and the region, e.g. lambda functions, then it is enough to give a meaningful name and qualify by environment. If the purpose is common, e.g. rds-log-cleaner, it may need an application.

${purpose}[-${application}]-${environment} - is the general form

e.g.