AWS Service Catalog: Self-Service Infrastructure Governance for Engineering Teams

Without governance, every team builds slightly different infrastructure. One team uses encrypted RDS, another does not. One team has VPC flow logs, another skips them. One team tags everything correctly, another tags nothing. At scale this inconsistency becomes a security and compliance problem that is expensive to remediate retroactively.

AWS Service Catalog lets platform teams define approved infrastructure products backed by CloudFormation templates. Developers browse a catalog of these products, fill in a small set of allowed parameters, and provision compliant infrastructure without knowing CloudFormation. The platform team controls what can be built. Developers control when and how much. In this article I will walk through setting up a Service Catalog portfolio with products, launch constraints, and the TagOptions that enforce tagging compliance automatically.

Portfolio and Product Structure

resource "aws_servicecatalog_portfolio" "platform" {
  name          = "Platform Infrastructure"
  description   = "Approved, compliant infrastructure products for engineering teams"
  provider_name = "Platform Engineering"

  tags = { ManagedBy = "terraform" }
}

resource "aws_s3_object" "rds_template" {
  bucket = aws_s3_bucket.service_catalog.bucket
  key    = "products/rds-postgres/v1.0.0/template.yaml"
  source = "${path.module}/catalog_products/rds-postgres.yaml"
  etag   = filemd5("${path.module}/catalog_products/rds-postgres.yaml")
}

resource "aws_servicecatalog_product" "rds_postgres" {
  name             = "PostgreSQL Database"
  description      = "Managed PostgreSQL on RDS with encryption, Multi-AZ, and automated backups"
  distributor      = "Platform Engineering"
  type             = "CLOUD_FORMATION_TEMPLATE"
  support_email    = "platform@yourcompany.com"
  support_url      = "https://wiki.yourcompany.com/platform/rds"
  support_description = "Contact the platform team for database sizing guidance"

  provisioning_artifact_parameters {
    name         = "v1.0.0"
    description  = "Initial version with Multi-AZ and encryption"
    type         = "CLOUD_FORMATION_TEMPLATE"
    template_url = "https://${aws_s3_bucket.service_catalog.bucket}.s3.amazonaws.com/${aws_s3_object.rds_template.key}"
  }

  tags = { ManagedBy = "terraform" }
}

resource "aws_servicecatalog_product_portfolio_association" "rds" {
  portfolio_id = aws_servicecatalog_portfolio.platform.id
  product_id   = aws_servicecatalog_product.rds_postgres.id
}

The CloudFormation Product Template

The template defines both what users can control and what is enforced. Parameters with AllowedValues restrict choices to compliant options. Resources with fixed values in the template enforce standards that users cannot override.

AWSTemplateFormatVersion: '2010-09-09'
Description: 'Service Catalog - PostgreSQL RDS Database'

Parameters:
  Environment:
    Type: String
    AllowedValues: [development, staging, production]
    Description: Deployment environment

  InstanceClass:
    Type: String
    AllowedValues:
      - db.t4g.micro
      - db.t4g.small
      - db.t4g.medium
      - db.r6g.large
      - db.r6g.xlarge
    Default: db.t4g.small
    Description: RDS instance class

  DatabaseName:
    Type: String
    MinLength: 3
    MaxLength: 63
    AllowedPattern: '[a-z][a-z0-9_]*'

Resources:
  Database:
    Type: AWS::RDS::DBInstance
    DeletionPolicy: Snapshot
    Properties:
      DBInstanceClass: !Ref InstanceClass
      Engine: postgres
      EngineVersion: '16.3'
      DBName: !Ref DatabaseName
      MasterUsername: dbadmin
      ManageMasterUserPassword: true
      StorageEncrypted: true
      MultiAZ: !If [IsProduction, true, false]
      BackupRetentionPeriod: !If [IsProduction, 14, 7]
      DeletionProtection: !If [IsProduction, true, false]
      EnableIAMDatabaseAuthentication: true
      MonitoringInterval: 60
      EnablePerformanceInsights: true
      Tags:
        - Key: Environment
          Value: !Ref Environment
        - Key: ManagedBy
          Value: ServiceCatalog

Conditions:
  IsProduction: !Equals [!Ref Environment, production]

Outputs:
  DatabaseEndpoint:
    Value: !GetAtt Database.Endpoint.Address

Storage encryption, IAM authentication, Performance Insights, and enhanced monitoring are not parameters in this template. They are hardcoded. Every database provisioned through this product has them enabled regardless of what the user wants. The Conditions block adjusts Multi-AZ, backup retention, and deletion protection based on the environment parameter, applying stricter settings for production automatically.

Launch Constraints and Principal Access

resource "aws_iam_role" "service_catalog_launch" {
  name = "service-catalog-launch-role"

  assume_role_policy = jsonencode({
    Version = "2012-10-17"
    Statement = [{
      Effect    = "Allow"
      Principal = { Service = "servicecatalog.amazonaws.com" }
      Action    = "sts:AssumeRole"
    }]
  })
}

resource "aws_iam_role_policy_attachment" "launch_role_rds" {
  role       = aws_iam_role.service_catalog_launch.name
  policy_arn = "arn:aws:iam::aws:policy/AmazonRDSFullAccess"
}

resource "aws_servicecatalog_constraint" "launch_role" {
  portfolio_id = aws_servicecatalog_portfolio.platform.id
  product_id   = aws_servicecatalog_product.rds_postgres.id
  type         = "LAUNCH"

  parameters = jsonencode({
    RoleArn = aws_iam_role.service_catalog_launch.arn
  })
}

resource "aws_servicecatalog_principal_portfolio_association" "developers" {
  portfolio_id   = aws_servicecatalog_portfolio.platform.id
  principal_arn  = aws_iam_role.developer.arn
  principal_type = "IAM"
}

resource "aws_servicecatalog_tag_option" "environment" {
  key   = "Environment"
  value = "production"
}

resource "aws_servicecatalog_tag_option_resource_association" "portfolio_env" {
  resource_id  = aws_servicecatalog_portfolio.platform.id
  tag_option_id = aws_servicecatalog_tag_option.environment.id
}

The launch constraint specifies that Service Catalog uses the launch role to provision resources rather than the end user’s IAM role. This means developers can provision RDS databases even if their IAM permissions do not include RDS access directly. The launch role has the necessary permissions. Users interact with the catalog through a controlled interface and cannot use it to provision resources outside the defined product templates.

Closing Thoughts

Service Catalog solves the governance-versus-velocity tradeoff by building compliance into the product templates rather than into the approval process. Developers provision what they need immediately. Everything they provision is compliant by construction. The platform team maintains the templates and the catalog rather than reviewing individual requests.

Start with your most commonly requested infrastructure types: databases, message queues, storage buckets. Build templates that enforce your security standards and expose only the parameters that legitimately vary between use cases. Add launch constraints so users provision through a controlled role rather than their own permissions. The self-service portal reduces platform team toil and gives developers faster access to compliant infrastructure.

Enjoy the cloud.

Osama


#AWS #ServiceCatalog #CloudGovernance #PlatformEngineering #CloudArchitecture #Terraform #InfrastructureAsCode #AmazonWebServices #SolutionsArchitect #CloudComputing #CloudCompliance #DevOps #SelfService #TechBlog #CloudInfrastructure #InternalDeveloperPlatform #IDP #CloudSecurity #Engineering #Automation

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.