Skip to main content

Naming Conventions

Introduction

Naming conventions are important for cloud resources because they help to organize and manage resources in a consistent and predictable way. By following a set of conventions for naming resources, it becomes easier to understand the purpose and use of each resource, and to find and identify specific resources when needed. Additionally, naming conventions can help to prevent naming conflicts, which can lead to errors and make it more difficult to manage resources. They also help with cost allocation and chargeback, by identifying which resources belong to which project or department. Additionally, naming conventions can help to promote best practices and make it easier to understand the purpose and use of different elements of code.

In cloud, resources can be created and deleted frequently, and it can be difficult to keep track of all the resources that are being used. Naming conventions make it easier to identify and manage resources by providing a clear and consistent way to name them. This helps to ensure that resources are used efficiently and effectively, and that resources are not accidentally deleted or misused.

Naming Standards and Cases

If the resource or tool has its naming standard, we follow them. Where in there are no recommended standard to be followed, we use kebab-case.

The other guides in this documents show how the resources are named across various tools and configuration languages.

Define Slug for Projects

Naming resource correctly helps to identify in which the accounts and projects resources belong to, and also it helps to distinguish the resources we create among other resources created by a particular system, i.e AWS IAM roles created by AWS, we add a prefix to our resources, and we can call the prefix slug.

Follow these rules when naming resources:

Names prefixed with project slug

If a resource is related to a project such as an EC2 instance or a security group, then we can begin with <projectslug>-....

Resources specific to an environment

Then we define the Environment slug to identify the environment which resource belongs to, use <projectslug>-<environment>-...

tip

There can be some exceptions on these prefixes for resources such as usernames and email addresses.

Based on the resources we create, the prefix for the resource names can be as below.

tip

When choosing a slug, it’s better to keep them short, yet descriptive. Keeping it very short like 2 characters, might not be a good idea when there are multiple similar objects, such as projects.

Define the Naming for projects in your organization

You can use the below template to keep organization and list of projects aligned.

NameSlug
Organization nameACME Corp
Organization email domain@acme.xyz
ProjectProject Xprojectx
EnvironmentStaging, Prodstg, prod