In your AWS management console select CloudFormation:

Click on Create Stack


AWSTemplateFormatVersion: 2010-09-09
Description: AWS CloudFormation IAM EC2 Role to get some IAM policies set up

Resources:
  DeltaXMLEC2Profile:
    Type: 'AWS::IAM::InstanceProfile'
    Properties:
      Path: /DeltaXML-EC2-Profile/
      Roles:
        - !Ref DeltaXMLRole

  DeltaXMLRole:
    Type: 'AWS::IAM::Role'
    Properties:
      RoleName: DeltaXML-AMI-Role
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - ec2.amazonaws.com
            Action:
              - 'sts:AssumeRole'
      ManagedPolicyArns:
        - 'arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore'
        - 'arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy'
      Path: /

  EC2Policy:
    Type: 'AWS::IAM::ManagedPolicy'
    Properties:
      ManagedPolicyName: DeltaXML-AMI-Policy
      PolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Action: 'ec2-instance-connect:SendSSHPublicKey'
            Resource: '*'
            Condition:
              StringEquals:
                'ec2:osuser': deltaxml
          - Effect: Allow
            Action: 'ec2:DescribeInstances'
            Resource: '*'
      Roles:
        - !Ref DeltaXMLRole
CODE

Click on the ‘template’ tab

Paste the CloudFormation script from above into the template area

(1) Validate the script (2) Submit the script

CloudFormation Stack progress

CloudFormation Stack Complete

Now you can continue to Setup your AWS EC2 Instance (Linux)