---
#
# Pre-requisites:
#
Resources:
  ThavaSSHGroupDefault:
    Type: AWS::EC2::SecurityGroup
    Properties:
        GroupDescription: Allow ssh to client host
        SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: 22
          ToPort: 22
          CidrIp: 0.0.0.0/0

  MyInstance:
    Type: AWS::EC2::Instance
    DependsOn: ThavaSSHGroupDefault
    Properties:
      AvailabilityZone: us-east-1c
      ImageId: ami-0ff8a91507f77f867
      # ImageId: ami-a4c7edb2  # Amazon Linux AMI 2017
      # ImageId: ami-0ff8a91507f77f867   # Amazon Linux AMI 2018
      # ImageId: ami-0c1481f2732d82982 # Ubuntu 2018 LTS
      InstanceType: t2.micro
      KeyName: aws-thava
      # InstanceType: t2.micro
      # Tip: aws ec2 describe-instances to see example existing configurations.

      # You must use NetworkInterfaces, to turn on auto Public IP.
      # If you explicitly specify NetworkInterfaces, you must specify
      # security group under this only as "GroupSet".
      NetworkInterfaces:
      - AssociatePublicIpAddress: "true"
        DeviceIndex: "0"
        GroupSet:
        - Ref: ThavaSSHGroupDefault

