AWS

MechCloud's Stateless Infrastructure as Code (IaC) for AWS enables you to declaratively manage your AWS resources without relying on state files, eliminating common issues like state drift. By defining your desired infrastructure in YAML and comparing it directly against your live AWS environment, you can provision, update, and delete resources with confidence. This feature supports a wide range of AWS EC2 resources (e.g., VPCs, subnets, security groups, instances) and integrates real-time pricing to provide proactive cost insights during planning.

For details on resource contexts (equivalent to Kubernetes namespaces for scoping resources), see the Resource Contexts documentation.

Key Concepts

Desired State

The desired state is your YAML blueprint describing the infrastructure you want. It's hierarchical, using nesting to define parent-child relationships (e.g., a subnet inside a VPC).

Requirements:

  • Each resource must have a unique relative path based on its hierarchy (e.g., vpc1/subnet1/instance1), similar to a Linux file path. This is your responsibility to ensure uniqueness and prevent conflicts.

  • Use snake_case for all properties (e.g., cidr_block instead of CidrBlock).

  • No explicit parent references (e.g., no vpc_id for a subnet—MechCloud infers from hierarchy).

  • References:

    • Sibling references (same parent): ref:<name> (e.g., ref:sg1).

    • Non-sibling references (cross-hierarchy): ref:<full_path> (e.g., ref:vpc1/sg1).

Actual State

The actual state is a real-time snapshot of your AWS resources in the selected context, formatted to match the desired state structure (hierarchical, snake_case properties). It includes resource types, names, identifiers (e.g., vpc-12345678), and properties.

Plan

The plan compares desired and actual states, proposing actions:

  • Create: New resources.

  • Update: In-place changes.

  • Recreate: When at least one immutable property differs (requires delete + create).

  • Delete: Remove extra resources.

  • None: No changes needed.

Plans show hierarchy with indentation (-- for children) and include real-time pricing for compute/storage resources (hourly/monthly costs, % change).

Last updated

Was this helpful?