Amazon Elastic Compute Cloud

2017/02/09 - Amazon Elastic Compute Cloud - 4 new api methods

Changes  Update ec2 client to latest version

AssociateIamInstanceProfile (new) Link ¶

Associates an IAM instance profile with a running or stopped instance. You cannot associate more than one IAM instance profile with an instance.

See also: AWS API Documentation

Request Syntax

client.associate_iam_instance_profile(
    IamInstanceProfile={
        'Arn': 'string',
        'Name': 'string'
    },
    InstanceId='string'
)
type IamInstanceProfile:

dict

param IamInstanceProfile:

[REQUIRED]

The IAM instance profile.

  • Arn (string) --

    The Amazon Resource Name (ARN) of the instance profile.

  • Name (string) --

    The name of the instance profile.

type InstanceId:

string

param InstanceId:

[REQUIRED]

The ID of the instance.

rtype:

dict

returns:

Response Syntax

{
    'IamInstanceProfileAssociation': {
        'AssociationId': 'string',
        'InstanceId': 'string',
        'IamInstanceProfile': {
            'Arn': 'string',
            'Id': 'string'
        },
        'State': 'associating'|'associated'|'disassociating'|'disassociated',
        'Timestamp': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • IamInstanceProfileAssociation (dict) --

      Information about the IAM instance profile association.

      • AssociationId (string) --

        The ID of the association.

      • InstanceId (string) --

        The ID of the instance.

      • IamInstanceProfile (dict) --

        The IAM instance profile.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the instance profile.

        • Id (string) --

          The ID of the instance profile.

      • State (string) --

        The state of the association.

      • Timestamp (datetime) --

        The time the IAM instance profile was associated with the instance.

ReplaceIamInstanceProfileAssociation (new) Link ¶

Replaces an IAM instance profile for the specified instance. You can use this action to change the IAM instance profile that's associated with an instance without having to disassociate the existing IAM instance profile first.

Use DescribeIamInstanceProfileAssociations to get the association ID.

See also: AWS API Documentation

Request Syntax

client.replace_iam_instance_profile_association(
    IamInstanceProfile={
        'Arn': 'string',
        'Name': 'string'
    },
    AssociationId='string'
)
type IamInstanceProfile:

dict

param IamInstanceProfile:

[REQUIRED]

The IAM instance profile.

  • Arn (string) --

    The Amazon Resource Name (ARN) of the instance profile.

  • Name (string) --

    The name of the instance profile.

type AssociationId:

string

param AssociationId:

[REQUIRED]

The ID of the existing IAM instance profile association.

rtype:

dict

returns:

Response Syntax

{
    'IamInstanceProfileAssociation': {
        'AssociationId': 'string',
        'InstanceId': 'string',
        'IamInstanceProfile': {
            'Arn': 'string',
            'Id': 'string'
        },
        'State': 'associating'|'associated'|'disassociating'|'disassociated',
        'Timestamp': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • IamInstanceProfileAssociation (dict) --

      Information about the IAM instance profile association.

      • AssociationId (string) --

        The ID of the association.

      • InstanceId (string) --

        The ID of the instance.

      • IamInstanceProfile (dict) --

        The IAM instance profile.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the instance profile.

        • Id (string) --

          The ID of the instance profile.

      • State (string) --

        The state of the association.

      • Timestamp (datetime) --

        The time the IAM instance profile was associated with the instance.

DisassociateIamInstanceProfile (new) Link ¶

Disassociates an IAM instance profile from a running or stopped instance.

Use DescribeIamInstanceProfileAssociations to get the association ID.

See also: AWS API Documentation

Request Syntax

client.disassociate_iam_instance_profile(
    AssociationId='string'
)
type AssociationId:

string

param AssociationId:

[REQUIRED]

The ID of the IAM instance profile association.

rtype:

dict

returns:

Response Syntax

{
    'IamInstanceProfileAssociation': {
        'AssociationId': 'string',
        'InstanceId': 'string',
        'IamInstanceProfile': {
            'Arn': 'string',
            'Id': 'string'
        },
        'State': 'associating'|'associated'|'disassociating'|'disassociated',
        'Timestamp': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • IamInstanceProfileAssociation (dict) --

      Information about the IAM instance profile association.

      • AssociationId (string) --

        The ID of the association.

      • InstanceId (string) --

        The ID of the instance.

      • IamInstanceProfile (dict) --

        The IAM instance profile.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the instance profile.

        • Id (string) --

          The ID of the instance profile.

      • State (string) --

        The state of the association.

      • Timestamp (datetime) --

        The time the IAM instance profile was associated with the instance.

DescribeIamInstanceProfileAssociations (new) Link ¶

Describes your IAM instance profile associations.

See also: AWS API Documentation

Request Syntax

client.describe_iam_instance_profile_associations(
    AssociationIds=[
        'string',
    ],
    Filters=[
        {
            'Name': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    MaxResults=123,
    NextToken='string'
)
type AssociationIds:

list

param AssociationIds:

One or more IAM instance profile associations.

  • (string) --

type Filters:

list

param Filters:

One or more filters.

  • instance-id - The ID of the instance.

  • state - The state of the association ( associating | associated | disassociating | disassociated).

  • (dict) --

    A filter name and value pair that is used to return a more specific list of results. Filters can be used to match a set of resources by various criteria, such as tags, attributes, or IDs.

    • Name (string) --

      The name of the filter. Filter names are case-sensitive.

    • Values (list) --

      One or more filter values. Filter values are case-sensitive.

      • (string) --

type MaxResults:

integer

param MaxResults:

The maximum number of results to return in a single call. To retrieve the remaining results, make another call with the returned NextToken value.

type NextToken:

string

param NextToken:

The token to request the next page of results.

rtype:

dict

returns:

Response Syntax

{
    'IamInstanceProfileAssociations': [
        {
            'AssociationId': 'string',
            'InstanceId': 'string',
            'IamInstanceProfile': {
                'Arn': 'string',
                'Id': 'string'
            },
            'State': 'associating'|'associated'|'disassociating'|'disassociated',
            'Timestamp': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • IamInstanceProfileAssociations (list) --

      Information about one or more IAM instance profile associations.

      • (dict) --

        Describes an association between an IAM instance profile and an instance.

        • AssociationId (string) --

          The ID of the association.

        • InstanceId (string) --

          The ID of the instance.

        • IamInstanceProfile (dict) --

          The IAM instance profile.

          • Arn (string) --

            The Amazon Resource Name (ARN) of the instance profile.

          • Id (string) --

            The ID of the instance profile.

        • State (string) --

          The state of the association.

        • Timestamp (datetime) --

          The time the IAM instance profile was associated with the instance.

    • NextToken (string) --

      The token to use to retrieve the next page of results. This value is null when there are no more results to return.