Associates the specified SSM document with the specified instance

    http://docs.aws.amazon.com/ssm/latest/APIReference/API_CreateAssociation.html

    CLI Examples:

    .. code-block:: bash

        salt-cloud -a ssm_create_association ec2-instance-name ssm_document=ssm-document-name

def ssm_create_association(name=None, kwargs=None, instance_id=None, call=None):
    '''
    Associates the specified SSM document with the specified instance

    http://docs.aws.amazon.com/ssm/latest/APIReference/API_CreateAssociation.html

    CLI Examples:

    .. code-block:: bash

        salt-cloud -a ssm_create_association ec2-instance-name ssm_document=ssm-document-name
    '''

    if call != 'action':
        raise SaltCloudSystemExit(
            'The ssm_create_association action must be called with '
            '-a or --action.'
        )

    if not kwargs:
        kwargs = {}

    if 'instance_id' in kwargs:
        instance_id = kwargs['instance_id']

    if name and not instance_id:
        instance_id = _get_node(name)['instanceId']

    if not name and not instance_id:
        log.error('Either a name or an instance_id is required.')
        return False

    if 'ssm_document' not in kwargs:
        log.error('A ssm_document is required.')
        return False

    params = {'Action': 'CreateAssociation',
              'InstanceId': instance_id,
              'Name': kwargs['ssm_document']}

    result = aws.query(params,
                       return_root=True,
                       location=get_location(),
                       provider=get_provider(),
                       product='ssm',
                       opts=__opts__,
                       sigver='4')
    log.info(result)
    return result