My Sample CF Templates

To create a S3 bucket

{
   "Resources" : {
       "HelloBucket" : {
            "Type" : "AWS::S3::Bucket",
            "Properties" : {
                 "BucketName" : "unnicf-testbucket"
             }
       }
    }
}

To launch EC2 instance with the following inputs

{
    "Parameters" : {
       "keyName" : {
           "Description" : "Unni - SSH to access EC2 Instance",
           "Type" : "String"
       },
      "aminame" : {
           "Description" : "Unni - Give AMI id",
           "Type" : "String"
       },
     "instanceclass" : {
          "Description" : "Unni - Enter instance class API Name",
          "Type" : "String"
      }
   },
   "Resources" : {
         "EC2Instance" : {
             "Type" : "AWS::EC2::Instance",
             "Properties" : {
             "SecurityGroups" : [ { "Ref" : "ISecgroup" } ],
             "KeyName" : { "Ref" : "keyName" },
             "ImageId" : { "Ref" : "aminame" },
             "InstanceType" : { "Ref" : "instanceclass" }
         }
   },
        "ISecgroup" : {
             "Type" : "AWS::EC2::SecurityGroup",
             "Properties" : {
             "GroupDescription" : "Unni - Security Group by CF",
             "SecurityGroupIngress" : [ {
                 "IpProtocol" : "tcp",
                 "FromPort" : "22",
                 "ToPort" : "22",
                 "CidrIp" : "0.0.0.0/0"
              },
              {
                "IpProtocol" : "tcp",
                "FromPort" : "80",
                "ToPort" : "80",
                "CidrIp" : "0.0.0.0/0"
             }
       ]
       }
    }
  }
}
 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s