AWS CloudFormation

2018/03/29 - AWS CloudFormation - 4 updated api methods

Changes  Enabling resource level permission control for StackSets APIs. Adding support for customers to use customized AdministrationRole to create security boundaries between different users.

CreateStackSet (updated) Link ¶
Changes (request)
{'AdministrationRoleARN': 'string'}

Creates a stack set.

See also: AWS API Documentation

Request Syntax

client.create_stack_set(
    StackSetName='string',
    Description='string',
    TemplateBody='string',
    TemplateURL='string',
    Parameters=[
        {
            'ParameterKey': 'string',
            'ParameterValue': 'string',
            'UsePreviousValue': True|False,
            'ResolvedValue': 'string'
        },
    ],
    Capabilities=[
        'CAPABILITY_IAM'|'CAPABILITY_NAMED_IAM',
    ],
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    AdministrationRoleARN='string',
    ClientRequestToken='string'
)
type StackSetName

string

param StackSetName

[REQUIRED]

The name to associate with the stack set. The name must be unique in the region where you create your stack set.

Note

A stack name can contain only alphanumeric characters (case-sensitive) and hyphens. It must start with an alphabetic character and can't be longer than 128 characters.

type Description

string

param Description

A description of the stack set. You can use the description to identify the stack set's purpose or other important information.

type TemplateBody

string

param TemplateBody

The structure that contains the template body, with a minimum length of 1 byte and a maximum length of 51,200 bytes. For more information, see Template Anatomy in the AWS CloudFormation User Guide.

Conditional: You must specify either the TemplateBody or the TemplateURL parameter, but not both.

type TemplateURL

string

param TemplateURL

The location of the file that contains the template body. The URL must point to a template (maximum size: 460,800 bytes) that's located in an Amazon S3 bucket. For more information, see Template Anatomy in the AWS CloudFormation User Guide.

Conditional: You must specify either the TemplateBody or the TemplateURL parameter, but not both.

type Parameters

list

param Parameters

The input parameters for the stack set template.

  • (dict) --

    The Parameter data type.

    • ParameterKey (string) --

      The key associated with the parameter. If you don't specify a key and value for a particular parameter, AWS CloudFormation uses the default value that is specified in your template.

    • ParameterValue (string) --

      The input value associated with the parameter.

    • UsePreviousValue (boolean) --

      During a stack update, use the existing parameter value that the stack is using for a given parameter key. If you specify true , do not specify a parameter value.

    • ResolvedValue (string) --

      Read-only. The value that corresponds to a Systems Manager parameter key. This field is returned only for SSMparameter types in the template.

type Capabilities

list

param Capabilities

A list of values that you must specify before AWS CloudFormation can create certain stack sets. Some stack set templates might include resources that can affect permissions in your AWS account—for example, by creating new AWS Identity and Access Management (IAM) users. For those stack sets, you must explicitly acknowledge their capabilities by specifying this parameter.

The only valid values are CAPABILITY_IAM and CAPABILITY_NAMED_IAM. The following resources require you to specify this parameter:

  • AWS::IAM::AccessKey

  • AWS::IAM::Group

  • AWS::IAM::InstanceProfile

  • AWS::IAM::Policy

  • AWS::IAM::Role

  • AWS::IAM::User

  • AWS::IAM::UserToGroupAddition

If your stack template contains these resources, we recommend that you review all permissions that are associated with them and edit their permissions if necessary.

If you have IAM resources, you can specify either capability. If you have IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If you don't specify this parameter, this action returns an InsufficientCapabilities error.

For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates.

  • (string) --

type Tags

list

param Tags

The key-value pairs to associate with this stack set and the stacks created from it. AWS CloudFormation also propagates these tags to supported resources that are created in the stacks. A maximum number of 50 tags can be specified.

If you specify tags as part of a CreateStackSet action, AWS CloudFormation checks to see if you have the required IAM permission to tag resources. If you don't, the entire CreateStackSet action fails with an access denied error, and the stack set is not created.

  • (dict) --

    The Tag type enables you to specify a key-value pair that can be used to store information about an AWS CloudFormation stack.

    • Key (string) -- [REQUIRED]

      Required . A string used to identify this tag. You can specify a maximum of 128 characters for a tag key. Tags owned by Amazon Web Services (AWS) have the reserved prefix: aws: .

    • Value (string) -- [REQUIRED]

      Required . A string containing the value for this tag. You can specify a maximum of 256 characters for a tag value.

type AdministrationRoleARN

string

param AdministrationRoleARN

The Amazon Resource Number (ARN) of the IAM role to use to create this stack set.

Specify an IAM role only if you are using customized administrator roles to control which users or groups can manage specific stack sets within the same administrator account. For more information, see Define Permissions for Multiple Administrators in the AWS CloudFormation User Guide .

type ClientRequestToken

string

param ClientRequestToken

A unique identifier for this CreateStackSet request. Specify this token if you plan to retry requests so that AWS CloudFormation knows that you're not attempting to create another stack set with the same name. You might retry CreateStackSet requests to ensure that AWS CloudFormation successfully received them.

If you don't specify an operation ID, the SDK generates one automatically.

This field is autopopulated if not provided.

rtype

dict

returns

Response Syntax

{
    'StackSetId': 'string'
}

Response Structure

  • (dict) --

    • StackSetId (string) --

      The ID of the stack set that you're creating.

DescribeStackSet (updated) Link ¶
Changes (response)
{'StackSet': {'AdministrationRoleARN': 'string', 'StackSetARN': 'string'}}

Returns the description of the specified stack set.

See also: AWS API Documentation

Request Syntax

client.describe_stack_set(
    StackSetName='string'
)
type StackSetName

string

param StackSetName

[REQUIRED]

The name or unique ID of the stack set whose description you want.

rtype

dict

returns

Response Syntax

{
    'StackSet': {
        'StackSetName': 'string',
        'StackSetId': 'string',
        'Description': 'string',
        'Status': 'ACTIVE'|'DELETED',
        'TemplateBody': 'string',
        'Parameters': [
            {
                'ParameterKey': 'string',
                'ParameterValue': 'string',
                'UsePreviousValue': True|False,
                'ResolvedValue': 'string'
            },
        ],
        'Capabilities': [
            'CAPABILITY_IAM'|'CAPABILITY_NAMED_IAM',
        ],
        'Tags': [
            {
                'Key': 'string',
                'Value': 'string'
            },
        ],
        'StackSetARN': 'string',
        'AdministrationRoleARN': 'string'
    }
}

Response Structure

  • (dict) --

    • StackSet (dict) --

      The specified stack set.

      • StackSetName (string) --

        The name that's associated with the stack set.

      • StackSetId (string) --

        The ID of the stack set.

      • Description (string) --

        A description of the stack set that you specify when the stack set is created or updated.

      • Status (string) --

        The status of the stack set.

      • TemplateBody (string) --

        The structure that contains the body of the template that was used to create or update the stack set.

      • Parameters (list) --

        A list of input parameters for a stack set.

        • (dict) --

          The Parameter data type.

          • ParameterKey (string) --

            The key associated with the parameter. If you don't specify a key and value for a particular parameter, AWS CloudFormation uses the default value that is specified in your template.

          • ParameterValue (string) --

            The input value associated with the parameter.

          • UsePreviousValue (boolean) --

            During a stack update, use the existing parameter value that the stack is using for a given parameter key. If you specify true , do not specify a parameter value.

          • ResolvedValue (string) --

            Read-only. The value that corresponds to a Systems Manager parameter key. This field is returned only for SSMparameter types in the template.

      • Capabilities (list) --

        The capabilities that are allowed in the stack set. Some stack set templates might include resources that can affect permissions in your AWS account—for example, by creating new AWS Identity and Access Management (IAM) users. For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates.

        • (string) --

      • Tags (list) --

        A list of tags that specify information about the stack set. A maximum number of 50 tags can be specified.

        • (dict) --

          The Tag type enables you to specify a key-value pair that can be used to store information about an AWS CloudFormation stack.

          • Key (string) --

            Required . A string used to identify this tag. You can specify a maximum of 128 characters for a tag key. Tags owned by Amazon Web Services (AWS) have the reserved prefix: aws: .

          • Value (string) --

            Required . A string containing the value for this tag. You can specify a maximum of 256 characters for a tag value.

      • StackSetARN (string) --

        The Amazon Resource Number (ARN) of the stack set.

      • AdministrationRoleARN (string) --

        The Amazon Resource Number (ARN) of the IAM role used to create or update the stack set.

        Use customized administrator roles to control which users or groups can manage specific stack sets within the same administrator account. For more information, see Define Permissions for Multiple Administrators in the AWS CloudFormation User Guide .

DescribeStackSetOperation (updated) Link ¶
Changes (response)
{'StackSetOperation': {'AdministrationRoleARN': 'string'}}

Returns the description of the specified stack set operation.

See also: AWS API Documentation

Request Syntax

client.describe_stack_set_operation(
    StackSetName='string',
    OperationId='string'
)
type StackSetName

string

param StackSetName

[REQUIRED]

The name or the unique stack ID of the stack set for the stack operation.

type OperationId

string

param OperationId

[REQUIRED]

The unique ID of the stack set operation.

rtype

dict

returns

Response Syntax

{
    'StackSetOperation': {
        'OperationId': 'string',
        'StackSetId': 'string',
        'Action': 'CREATE'|'UPDATE'|'DELETE',
        'Status': 'RUNNING'|'SUCCEEDED'|'FAILED'|'STOPPING'|'STOPPED',
        'OperationPreferences': {
            'RegionOrder': [
                'string',
            ],
            'FailureToleranceCount': 123,
            'FailureTolerancePercentage': 123,
            'MaxConcurrentCount': 123,
            'MaxConcurrentPercentage': 123
        },
        'RetainStacks': True|False,
        'AdministrationRoleARN': 'string',
        'CreationTimestamp': datetime(2015, 1, 1),
        'EndTimestamp': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) --

    • StackSetOperation (dict) --

      The specified stack set operation.

      • OperationId (string) --

        The unique ID of a stack set operation.

      • StackSetId (string) --

        The ID of the stack set.

      • Action (string) --

        The type of stack set operation: CREATE , UPDATE , or DELETE . Create and delete operations affect only the specified stack set instances that are associated with the specified stack set. Update operations affect both the stack set itself, as well as all associated stack set instances.

      • Status (string) --

        The status of the operation.

        • FAILED : The operation exceeded the specified failure tolerance. The failure tolerance value that you've set for an operation is applied for each region during stack create and update operations. If the number of failed stacks within a region exceeds the failure tolerance, the status of the operation in the region is set to FAILED . This in turn sets the status of the operation as a whole to FAILED , and AWS CloudFormation cancels the operation in any remaining regions.

        • RUNNING : The operation is currently being performed.

        • STOPPED : The user has cancelled the operation.

        • STOPPING : The operation is in the process of stopping, at user request.

        • SUCCEEDED : The operation completed creating or updating all the specified stacks without exceeding the failure tolerance for the operation.

      • OperationPreferences (dict) --

        The preferences for how AWS CloudFormation performs this stack set operation.

        • RegionOrder (list) --

          The order of the regions in where you want to perform the stack operation.

          • (string) --

        • FailureToleranceCount (integer) --

          The number of accounts, per region, for which this operation can fail before AWS CloudFormation stops the operation in that region. If the operation is stopped in a region, AWS CloudFormation doesn't attempt the operation in any subsequent regions.

          Conditional: You must specify either FailureToleranceCount or FailureTolerancePercentage (but not both).

        • FailureTolerancePercentage (integer) --

          The percentage of accounts, per region, for which this stack operation can fail before AWS CloudFormation stops the operation in that region. If the operation is stopped in a region, AWS CloudFormation doesn't attempt the operation in any subsequent regions.

          When calculating the number of accounts based on the specified percentage, AWS CloudFormation rounds down to the next whole number.

          Conditional: You must specify either FailureToleranceCount or FailureTolerancePercentage , but not both.

        • MaxConcurrentCount (integer) --

          The maximum number of accounts in which to perform this operation at one time. This is dependent on the value of FailureToleranceCountMaxConcurrentCount is at most one more than the FailureToleranceCount .

          Note that this setting lets you specify the maximum for operations. For large deployments, under certain circumstances the actual number of accounts acted upon concurrently may be lower due to service throttling.

          Conditional: You must specify either MaxConcurrentCount or MaxConcurrentPercentage , but not both.

        • MaxConcurrentPercentage (integer) --

          The maximum percentage of accounts in which to perform this operation at one time.

          When calculating the number of accounts based on the specified percentage, AWS CloudFormation rounds down to the next whole number. This is true except in cases where rounding down would result is zero. In this case, CloudFormation sets the number as one instead.

          Note that this setting lets you specify the maximum for operations. For large deployments, under certain circumstances the actual number of accounts acted upon concurrently may be lower due to service throttling.

          Conditional: You must specify either MaxConcurrentCount or MaxConcurrentPercentage , but not both.

      • RetainStacks (boolean) --

        For stack set operations of action type DELETE , specifies whether to remove the stack instances from the specified stack set, but doesn't delete the stacks. You can't reassociate a retained stack, or add an existing, saved stack to a new stack set.

      • AdministrationRoleARN (string) --

        The Amazon Resource Number (ARN) of the IAM role used to perform this stack set operation.

        Use customized administrator roles to control which users or groups can manage specific stack sets within the same administrator account. For more information, see Define Permissions for Multiple Administrators in the AWS CloudFormation User Guide .

      • CreationTimestamp (datetime) --

        The time at which the operation was initiated. Note that the creation times for the stack set operation might differ from the creation time of the individual stacks themselves. This is because AWS CloudFormation needs to perform preparatory work for the operation, such as dispatching the work to the requested regions, before actually creating the first stacks.

      • EndTimestamp (datetime) --

        The time at which the stack set operation ended, across all accounts and regions specified. Note that this doesn't necessarily mean that the stack set operation was successful, or even attempted, in each account or region.

UpdateStackSet (updated) Link ¶
Changes (request)
{'AdministrationRoleARN': 'string'}

Updates the stack set and all associated stack instances.

Even if the stack set operation created by updating the stack set fails (completely or partially, below or above a specified failure tolerance), the stack set is updated with your changes. Subsequent CreateStackInstances calls on the specified stack set use the updated stack set.

See also: AWS API Documentation

Request Syntax

client.update_stack_set(
    StackSetName='string',
    Description='string',
    TemplateBody='string',
    TemplateURL='string',
    UsePreviousTemplate=True|False,
    Parameters=[
        {
            'ParameterKey': 'string',
            'ParameterValue': 'string',
            'UsePreviousValue': True|False,
            'ResolvedValue': 'string'
        },
    ],
    Capabilities=[
        'CAPABILITY_IAM'|'CAPABILITY_NAMED_IAM',
    ],
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    OperationPreferences={
        'RegionOrder': [
            'string',
        ],
        'FailureToleranceCount': 123,
        'FailureTolerancePercentage': 123,
        'MaxConcurrentCount': 123,
        'MaxConcurrentPercentage': 123
    },
    AdministrationRoleARN='string',
    OperationId='string'
)
type StackSetName

string

param StackSetName

[REQUIRED]

The name or unique ID of the stack set that you want to update.

type Description

string

param Description

A brief description of updates that you are making.

type TemplateBody

string

param TemplateBody

The structure that contains the template body, with a minimum length of 1 byte and a maximum length of 51,200 bytes. For more information, see Template Anatomy in the AWS CloudFormation User Guide.

Conditional: You must specify only one of the following parameters: TemplateBody or TemplateURL —or set UsePreviousTemplate to true.

type TemplateURL

string

param TemplateURL

The location of the file that contains the template body. The URL must point to a template (maximum size: 460,800 bytes) that is located in an Amazon S3 bucket. For more information, see Template Anatomy in the AWS CloudFormation User Guide.

Conditional: You must specify only one of the following parameters: TemplateBody or TemplateURL —or set UsePreviousTemplate to true.

type UsePreviousTemplate

boolean

param UsePreviousTemplate

Use the existing template that's associated with the stack set that you're updating.

Conditional: You must specify only one of the following parameters: TemplateBody or TemplateURL —or set UsePreviousTemplate to true.

type Parameters

list

param Parameters

A list of input parameters for the stack set template.

  • (dict) --

    The Parameter data type.

    • ParameterKey (string) --

      The key associated with the parameter. If you don't specify a key and value for a particular parameter, AWS CloudFormation uses the default value that is specified in your template.

    • ParameterValue (string) --

      The input value associated with the parameter.

    • UsePreviousValue (boolean) --

      During a stack update, use the existing parameter value that the stack is using for a given parameter key. If you specify true , do not specify a parameter value.

    • ResolvedValue (string) --

      Read-only. The value that corresponds to a Systems Manager parameter key. This field is returned only for SSMparameter types in the template.

type Capabilities

list

param Capabilities

A list of values that you must specify before AWS CloudFormation can create certain stack sets. Some stack set templates might include resources that can affect permissions in your AWS account—for example, by creating new AWS Identity and Access Management (IAM) users. For those stack sets, you must explicitly acknowledge their capabilities by specifying this parameter.

The only valid values are CAPABILITY_IAM and CAPABILITY_NAMED_IAM. The following resources require you to specify this parameter:

  • AWS::IAM::AccessKey

  • AWS::IAM::Group

  • AWS::IAM::InstanceProfile

  • AWS::IAM::Policy

  • AWS::IAM::Role

  • AWS::IAM::User

  • AWS::IAM::UserToGroupAddition

If your stack template contains these resources, we recommend that you review all permissions that are associated with them and edit their permissions if necessary.

If you have IAM resources, you can specify either capability. If you have IAM resources with custom names, you must specify CAPABILITY_NAMED_IAM. If you don't specify this parameter, this action returns an InsufficientCapabilities error.

For more information, see Acknowledging IAM Resources in AWS CloudFormation Templates.

  • (string) --

type Tags

list

param Tags

The key-value pairs to associate with this stack set and the stacks created from it. AWS CloudFormation also propagates these tags to supported resources that are created in the stacks. You can specify a maximum number of 50 tags.

If you specify tags for this parameter, those tags replace any list of tags that are currently associated with this stack set. This means:

  • If you don't specify this parameter, AWS CloudFormation doesn't modify the stack's tags.

  • If you specify any tags using this parameter, you must specify all the tags that you want associated with this stack set, even tags you've specifed before (for example, when creating the stack set or during a previous update of the stack set.). Any tags that you don't include in the updated list of tags are removed from the stack set, and therefore from the stacks and resources as well.

  • If you specify an empty value, AWS CloudFormation removes all currently associated tags.

If you specify new tags as part of an UpdateStackSet action, AWS CloudFormation checks to see if you have the required IAM permission to tag resources. If you omit tags that are currently associated with the stack set from the list of tags you specify, AWS CloudFormation assumes that you want to remove those tags from the stack set, and checks to see if you have permission to untag resources. If you don't have the necessary permission(s), the entire UpdateStackSet action fails with an access denied error, and the stack set is not updated.

  • (dict) --

    The Tag type enables you to specify a key-value pair that can be used to store information about an AWS CloudFormation stack.

    • Key (string) -- [REQUIRED]

      Required . A string used to identify this tag. You can specify a maximum of 128 characters for a tag key. Tags owned by Amazon Web Services (AWS) have the reserved prefix: aws: .

    • Value (string) -- [REQUIRED]

      Required . A string containing the value for this tag. You can specify a maximum of 256 characters for a tag value.

type OperationPreferences

dict

param OperationPreferences

Preferences for how AWS CloudFormation performs this stack set operation.

  • RegionOrder (list) --

    The order of the regions in where you want to perform the stack operation.

    • (string) --

  • FailureToleranceCount (integer) --

    The number of accounts, per region, for which this operation can fail before AWS CloudFormation stops the operation in that region. If the operation is stopped in a region, AWS CloudFormation doesn't attempt the operation in any subsequent regions.

    Conditional: You must specify either FailureToleranceCount or FailureTolerancePercentage (but not both).

  • FailureTolerancePercentage (integer) --

    The percentage of accounts, per region, for which this stack operation can fail before AWS CloudFormation stops the operation in that region. If the operation is stopped in a region, AWS CloudFormation doesn't attempt the operation in any subsequent regions.

    When calculating the number of accounts based on the specified percentage, AWS CloudFormation rounds down to the next whole number.

    Conditional: You must specify either FailureToleranceCount or FailureTolerancePercentage , but not both.

  • MaxConcurrentCount (integer) --

    The maximum number of accounts in which to perform this operation at one time. This is dependent on the value of FailureToleranceCountMaxConcurrentCount is at most one more than the FailureToleranceCount .

    Note that this setting lets you specify the maximum for operations. For large deployments, under certain circumstances the actual number of accounts acted upon concurrently may be lower due to service throttling.

    Conditional: You must specify either MaxConcurrentCount or MaxConcurrentPercentage , but not both.

  • MaxConcurrentPercentage (integer) --

    The maximum percentage of accounts in which to perform this operation at one time.

    When calculating the number of accounts based on the specified percentage, AWS CloudFormation rounds down to the next whole number. This is true except in cases where rounding down would result is zero. In this case, CloudFormation sets the number as one instead.

    Note that this setting lets you specify the maximum for operations. For large deployments, under certain circumstances the actual number of accounts acted upon concurrently may be lower due to service throttling.

    Conditional: You must specify either MaxConcurrentCount or MaxConcurrentPercentage , but not both.

type AdministrationRoleARN

string

param AdministrationRoleARN

The Amazon Resource Number (ARN) of the IAM role to use to update this stack set.

Specify an IAM role only if you are using customized administrator roles to control which users or groups can manage specific stack sets within the same administrator account. For more information, see Define Permissions for Multiple Administrators in the AWS CloudFormation User Guide .

If you specify a customized administrator role, AWS CloudFormation uses that role to update the stack. If you do not specify a customized administrator role, AWS CloudFormation performs the update using the role previously associated with the stack set, so long as you have permissions to perform operations on the stack set.

type OperationId

string

param OperationId

The unique ID for this stack set operation.

The operation ID also functions as an idempotency token, to ensure that AWS CloudFormation performs the stack set operation only once, even if you retry the request multiple times. You might retry stack set operation requests to ensure that AWS CloudFormation successfully received them.

If you don't specify an operation ID, AWS CloudFormation generates one automatically.

Repeating this stack set operation with a new operation ID retries all stack instances whose status is OUTDATED .

This field is autopopulated if not provided.

rtype

dict

returns

Response Syntax

{
    'OperationId': 'string'
}

Response Structure

  • (dict) --

    • OperationId (string) --

      The unique ID for this stack set operation.