All Products
Search
Document Center

Resource Orchestration Service:Transform AWS CloudFormation templates into ROS templates

Last Updated:Jun 16, 2026

You can transform an AWS CloudFormation template into a Resource Orchestration Service (ROS) template. This example uses a VPC and security group to walk through the process.

Background information

For more information about AWS CloudFormation templates, see Working with AWS CloudFormation templates.

Step 1: Edit the source template file

The following example shows an AWS CloudFormation template file:

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "This template creates a VPC and a security group.",
  "Metadata": {
    "AWS::CloudFormation::Interface": {
      "ParameterGroups": {
        "Parameters": [
          "CidrBlock"
        ],
        "Label": {
          "default": "VPC"
        }
      },
      "ParameterLabels": {
        "CidrBlock": {
          "default": "Vpc Cidr Block"
        }
      }
    }
  },
  "Parameters": {
    "CidrBlock": {
      "Type": "String",
      "Default": "10.0.0.0/16"
    }
  },
  "Resources": {
    "MyVpc": {
      "DeletionPolicy": "Retain",
      "Type": "AWS::EC2::VPC",
      "Properties": {
        "CidrBlock": {
          "Ref": "CidrBlock"
        },
        "EnableDnsSupport": "false",
        "EnableDnsHostnames": "false",
        "InstanceTenancy": "dedicated",
        "Tags": [
          {
            "Key": "foo",
            "Value": "bar"
          }
        ]
      }
    },
    "MySg": {
      "DependsOn": "MyVpc",
      "Type": "AWS::EC2::SecurityGroup",
      "Properties": {
        "GroupDescription": "Create vpc security group",
        "VpcId": {
          "Ref": "MyVpc"
        }
      }
    }
  },
  "Outputs": {
    "VpcId": {
      "Description": "Vpc ID",
      "Value": {
        "Ref": "MyVpc"
      }
    },
    "SgId": {
      "Description": "SecurityGroup ID",
      "Value": {
        "Fn::GetAtt": [
          "MySg",
          "GroupId"
        ]
      }
    }
  }
}

Step 2: Transform the template

Run the following command to transform the AWS CloudFormation template into an ROS template. A JSON file named template.json is generated in the current directory.

rostran transform templates/cloudformation/vpc_sg.json --target-format json

Step 3: View the transformed ROS template

Open the template.json file to view the transformed ROS template.

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "This template creates a VPC and a security group.",
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": {
        "Parameters": [
          "CidrBlock"
        ],
        "Label": {
          "default": "VPC"
        }
      },
      "ParameterLabels": {
        "CidrBlock": {
          "default": "Vpc Cidr Block"
        }
      }
    }
  },
  "Parameters": {
    "CidrBlock": {
      "Type": "String",
      "Default": "10.0.0.0/16",
      "Label": "Vpc Cidr Block"
    }
  },
  "Resources": {
    "MyVpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": {
          "Ref": "CidrBlock"
        },
        "Tags": [
          {
            "Key": "foo",
            "Value": "bar"
          }
        ]
      },
      "DeletionPolicy": "Retain"
    },
    "MySg": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "Description": "Create vpc security group",
        "VpcId": {
          "Ref": "MyVpc"
        }
      },
      "DependsOn": "MyVpc"
    }
  },
  "Outputs": {
    "VpcId": {
      "Value": {
        "Ref": "MyVpc"
      }
    },
    "SgId": {
      "Value": {
        "Fn::GetAtt": [
          "MySg",
          "SecurityGroupId"
        ]
      }
    }
  }
}