1

I am trying to find a way to set default VPCs, Subnets and Security Groups in the Cluster.template JSON file.

Is there a way to pass an existing VPC ( or Subnet/Security group) as a parameter to the template using the "Ref" built-in?

This Obviously dones't work:

"Parameters": {
"VpcId": {
   "Type": "AWS::EC2::VPC::Id",
   "Default": { "Ref" : "vpc-123456789" },
....
}
Varda Elentári
  • 223
  • 4
  • 11

1 Answers1

3
"Parameters": {
  "VpcId": {
    "Type": "AWS::EC2::VPC::Id",
    "Default": "vpc-123456789" ,
  }
}

Then to use that vpc-id by using the Ref function

"Resources" :{
  "DbSubnet1" : {
    "Type" : "AWS::EC2::Subnet",
    "Properties" : {
      "AvailabilityZone" : "us-east-1c"
      "VpcId" :  { "Ref" : "VpcId" },
      "CidrBlock" : "10.0.1.0/24" 
     }
  }
}
strongjz
  • 832
  • 4
  • 7