ElastiCache / Client / create_cache_security_group

create_cache_security_group#

ElastiCache.Client.create_cache_security_group(**kwargs)#

Creates a new cache security group. Use a cache security group to control access to one or more clusters.

Cache security groups are only used when you are creating a cluster outside of an Amazon Virtual Private Cloud (Amazon VPC). If you are creating a cluster inside of a VPC, use a cache subnet group instead. For more information, see CreateCacheSubnetGroup.

See also: AWS API Documentation

Request Syntax

response = client.create_cache_security_group(
    CacheSecurityGroupName='string',
    Description='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
Parameters:
  • CacheSecurityGroupName (string) –

    [REQUIRED]

    A name for the cache security group. This value is stored as a lowercase string.

    Constraints: Must contain no more than 255 alphanumeric characters. Cannot be the word “Default”.

    Example: mysecuritygroup

  • Description (string) –

    [REQUIRED]

    A description for the cache security group.

  • Tags (list) –

    A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.

    • (dict) –

      A tag that can be added to an ElastiCache cluster or replication group. Tags are composed of a Key/Value pair. You can use tags to categorize and track all your ElastiCache resources, with the exception of global replication group. When you add or remove tags on replication groups, those actions will be replicated to all nodes in the replication group. A tag with a null Value is permitted.

      • Key (string) –

        The key for the tag. May not be null.

      • Value (string) –

        The tag’s value. May be null.

Return type:

dict

Returns:

Response Syntax

{
    'CacheSecurityGroup': {
        'OwnerId': 'string',
        'CacheSecurityGroupName': 'string',
        'Description': 'string',
        'EC2SecurityGroups': [
            {
                'Status': 'string',
                'EC2SecurityGroupName': 'string',
                'EC2SecurityGroupOwnerId': 'string'
            },
        ],
        'ARN': 'string'
    }
}

Response Structure

  • (dict) –

    • CacheSecurityGroup (dict) –

      Represents the output of one of the following operations:

      • AuthorizeCacheSecurityGroupIngress

      • CreateCacheSecurityGroup

      • RevokeCacheSecurityGroupIngress

      • OwnerId (string) –

        The Amazon account ID of the cache security group owner.

      • CacheSecurityGroupName (string) –

        The name of the cache security group.

      • Description (string) –

        The description of the cache security group.

      • EC2SecurityGroups (list) –

        A list of Amazon EC2 security groups that are associated with this cache security group.

        • (dict) –

          Provides ownership and status information for an Amazon EC2 security group.

          • Status (string) –

            The status of the Amazon EC2 security group.

          • EC2SecurityGroupName (string) –

            The name of the Amazon EC2 security group.

          • EC2SecurityGroupOwnerId (string) –

            The Amazon account ID of the Amazon EC2 security group owner.

      • ARN (string) –

        The ARN of the cache security group,

Exceptions

  • ElastiCache.Client.exceptions.CacheSecurityGroupAlreadyExistsFault

  • ElastiCache.Client.exceptions.CacheSecurityGroupQuotaExceededFault

  • ElastiCache.Client.exceptions.TagQuotaPerResourceExceeded

  • ElastiCache.Client.exceptions.InvalidParameterValueException

  • ElastiCache.Client.exceptions.InvalidParameterCombinationException

Examples

Creates an ElastiCache security group. ElastiCache security groups are only for clusters not running in an AWS VPC.

response = client.create_cache_security_group(
    CacheSecurityGroupName='my-cache-sec-grp',
    Description='Example ElastiCache security group.',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}