Potential Scripts - Kahuna915/Capstone-Cloud-Integration GitHub Wiki

Create Instances

- name: Create EC2 Instances
  vars:
    region: us-east-1
    keypair: 
    security_group: 
    instance_type: t2.micro
    image_id:
    count: 1
    subnet_id:
  tasks:
    - name: Create EC2 instances
      ec2:
        instance_type: "{{ instance_type }}"
        image: "{{ image_id }}"
        key_name: "{{ keypair }}"
        region: "{{ region }}"
        count: "{{ count }}"
        subnet_id: "{{ subnet_id }}"
        group_id: "{{ security_group }}"
      register: ec2

Launch Instances necessary variables

# Variables
AMI=""
INSTANCE_TYPE="t2.micro"
KEY_NAME=""
SECURITY_GROUP=""
SUBNET_ID=""
TAGS="Key=Name,Value=my-instance"

New IAM user

Resources:
  MyUser:
    Type: AWS::IAM::User
    Properties:
      UserName: my-new-user
      Groups:
        - Admins
      LoginProfile:
        Password: myPassword123