Cloudformation YAML Script

, , Leave a comment

AWSTemplateFormatVersion: "2010-09-09"

  Description: "Basic Ec2"

  Resources:

    Ec2Instance1:

      Type: AWS::EC2::Instance

      Properties:

        InstanceType: t2.small

        SubnetId: subnet-xxxx

        SecurityGroupIds:

        - !Ref InstanceSecurityGroup

        ImageId: ami-d8bdebb8

        KeyName: aws-controlpanel

    Ec2Instance2:

      Type: AWS::EC2::Instance

      Properties:

        InstanceType: t2.small

        SubnetId: subnet-xxxx

        ImageId: ami-d8bdebb8

        KeyName: aws-controlpanel

    InstanceSecurityGroup:

      Type: AWS::EC2::SecurityGroup

      Properties:

        GroupDescription: SSH access via port 22

        VpcId: vpc-xxxx

        SecurityGroupIngress:

        - IpProtocol: tcp

          FromPort: 22

          ToPort: 22

          CidrIp: 0.0.0.0/0
 

Leave a Reply