Resource Tags
Resource Tags are key-value pairs that ImageFactory applies to the images it builds across different cloud providers. These tags provide a standardized way to organize, manage, and track your golden images within your cloud infrastructure.
Tag Properties
Every tag defined in ImageFactory must adhere to the following constraints:
- Key: 3-120 characters. Must be unique within the tag set.
- Value: 1-120 characters.
Tags are defined at the template level. When a template is built, the specified tags are automatically applied to the resulting image artifacts.
Cloud-Specific Behavior
ImageFactory translates your tag definitions into the native tagging or labeling mechanism of the target cloud provider.
AWS (Amazon Web Services)
In AWS, tags are applied to both the Amazon Machine Image (AMI) and the associated EBS snapshots. This ensures that all resources created during the build process are correctly labeled.
Azure
For Azure builds, tags are applied to the Gallery Image Version resource. If you have enabled the creation of a managed image alongside the gallery version, the tags are applied to that resource as well.
GCP (Google Cloud Platform)
In GCP, tags are implemented as "Labels" on the Compute Engine image resource. Note that GCP labels have stricter naming requirements (lowercase, numbers, dashes, and underscores only), which ImageFactory handles during the build process.
Common Use Cases
Standardizing tags across your golden images enables several critical operational workflows.
Cost Allocation
Track the costs associated with image storage and build processes by tagging images with department or project codes.
| Key | Example Value |
|---|---|
CostCenter | IT-OPS-101 |
Project | CloudMigration |
Environment Identification
Identify which environment an image is intended for, helping to prevent the accidental use of development images in production.
| Key | Example Value |
|---|---|
Environment | Production |
Tier | Web |
Compliance and Security
Tag images with their compliance status or the security policy they adhere to.
| Key | Example Value |
|---|---|
Compliance | PCI-DSS |
SecurityLevel | High |
Ownership and Support
Provide contact information for the team responsible for maintaining the image.
| Key | Example Value |
|---|---|
Owner | PlatformTeam |
Contact | devops-alerts@company.com |
Immutability and Updates
Tags are immutable for a specific build. If you change the tags in a template definition, the new tags will only be applied to future builds. Existing images built from that template will retain the tags they were originally created with.
To update tags on an existing image, you must trigger a rebuild of the template.
Configuring Tags
Tags are configured during template creation in the Basic Settings step, or by editing an existing template. Add key-value pairs in the Tags section to define the metadata that will be applied to your built images.
For a step-by-step walkthrough, see the Creating a Template guide.
You can also configure tags programmatically when creating or updating a template:
mutation CreateTemplateWithTags($input: CreateTemplateInput!) {
createTemplate(input: $input) {
id
name
tags {
key
value
}
}
}
Variables:
{
"input": {
"name": "Hardened-Ubuntu-22.04",
"distributionId": "ubuntu-2204-id",
"accountId": "aws-prod-account-id",
"tags": [
{
"key": "ManagedBy",
"value": "ImageFactory"
},
{
"key": "OS",
"value": "Ubuntu"
},
{
"key": "Version",
"value": "22.04-LTS"
}
]
}
}
Best Practices
- Standardize Keys: Use a consistent naming convention for tag keys across all templates (e.g., PascalCase or kebab-case).
- Automate Tagging: Include mandatory tags in your CI/CD pipeline when creating templates via the API.
- Avoid Sensitive Data: Do not store secrets or sensitive information in tags, as they are often visible to anyone with read access to the cloud account. Use Customer Variables for sensitive data.