

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 创建 ElastiCache 参数组
<a name="ParameterGroups.Creating"></a>

如果存在一个或多个要从默认值更改的参数值，则需要创建新参数组。您可以使用 ElastiCache 控制台、AWS CLI 或 ElastiCache API 创建参数组。

## 创建 ElastiCache 参数组（控制台）
<a name="ParameterGroups.Creating.CON"></a>

以下过程介绍了如何使用 ElastiCache 控制台创建参数组。

**使用 ElastiCache 控制台创建参数组**

1. 登录 AWS 管理控制台 并打开 ElastiCache 控制台 ([https://console.aws.amazon.com/elasticache/](https://console.aws.amazon.com/elasticache/))。

1. 要查看所有可用的参数组列表，请在导航窗格左侧选择**Parameter Groups**。

1. 要创建参数组，请选择 **Create Parameter Group**。

   **Create Parameter Group（创建参数组）**屏幕随即出现。

1. 从 **Family** 列表中，选择将作为参数组的模板的参数组系列。

   参数组系列（例如 *memcached1.4* 或 *redis3.2*）定义了参数组中的实际参数及其初始值。参数组系列必须与集群的引擎和版本一致。

1. 在 **Name** 框中，键入此参数组的唯一名称。

   在创建集群或修改集群的参数组时，您将按参数组的名称选择参数组。因此，建议名称具有信息性，并且以某种方法标识该参数组的系列。

   参数组命名约束如下：
   + 必须以 ASCII 字母开头。
   + 只能包含 ASCII 字母、数字和连字符。
   + 长度必须介于 1 到 255 个字符之间。
   + 不能包含两个连续连字符。
   + 不能以连字符结束。

1. 在 **Description** 框中，键入参数组的说明。

1. 要创建参数组，请选择 **Create**。

   要在不创建参数组的情况下终止此过程，请选择 **Cancel**。

1. 创建参数组后，它将具有系列的默认值。要更改默认值，您必须修改参数组。有关更多信息，请参阅 [修改 ElastiCache 参数组](ParameterGroups.Modifying.md)。

## 创建 ElastiCache 参数组（AWS CLI）
<a name="ParameterGroups.Creating.CLI"></a>

要使用 AWS CLI 创建参数组，请使用带以下参数的命令 `create-cache-parameter-group`。
+ `--cache-parameter-group-name` – 参数组的名称。

  参数组命名约束如下：
  + 必须以 ASCII 字母开头。
  + 只能包含 ASCII 字母、数字和连字符。
  + 长度必须介于 1 到 255 个字符之间。
  + 不能包含两个连续连字符。
  + 不能以连字符结束。
+ `--cache-parameter-group-family` – 参数组的引擎和版本系列。
+ `--description` – 用户提供的参数组描述。

**Example**  
以下示例使用 memcached1.4 系列作为模板来创建名为 *myMem14* 的参数组。  
对于 Linux、macOS 或 Unix：  

```
aws elasticache create-cache-parameter-group \
    --cache-parameter-group-name myMem14  \
    --cache-parameter-group-family memcached1.4 \
    --description "My first parameter group"
```
对于 Windows：  

```
aws elasticache create-cache-parameter-group ^
    --cache-parameter-group-name myMem14  ^
    --cache-parameter-group-family memcached1.4 ^
    --description "My first parameter group"
```
该命令的输出内容应类似如下所示。  

```
{
    "CacheParameterGroup": {
        "CacheParameterGroupName": "myMem14", 
        "CacheParameterGroupFamily": "memcached1.4", 
        "Description": "My first  parameter group"
    }
}
```

**Example**  
以下示例使用 redis2.8 系列作为模板来创建名为 *myRed28* 的参数组。  
对于 Linux、macOS 或 Unix：  

```
aws elasticache create-cache-parameter-group \
    --cache-parameter-group-name myRed28  \
    --cache-parameter-group-family redis2.8 \
    --description "My first parameter group"
```
对于 Windows：  

```
aws elasticache create-cache-parameter-group ^
    --cache-parameter-group-name myRed28  ^
    --cache-parameter-group-family redis2.8 ^
    --description "My first parameter group"
```
该命令的输出内容应类似如下所示。  

```
{
    "CacheParameterGroup": {
        "CacheParameterGroupName": "myRed28", 
        "CacheParameterGroupFamily": "redis2.8", 
        "Description": "My first parameter group"
    }
}
```

创建参数组后，它将具有系列的默认值。要更改默认值，您必须修改参数组。有关更多信息，请参阅 [修改 ElastiCache 参数组](ParameterGroups.Modifying.md)。

有关更多信息，请参阅 [https://docs.aws.amazon.com/cli/latest/reference/elasticache/create-cache-parameter-group.html](https://docs.aws.amazon.com/cli/latest/reference/elasticache/create-cache-parameter-group.html)。

## 创建 ElastiCache 参数组（ElastiCache API）
<a name="ParameterGroups.Creating.API"></a>

要使用 ElastiCache API 创建参数组，请使用带以下参数的 `CreateCacheParameterGroup` 操作。
+ `ParameterGroupName` – 参数组的名称。

  参数组命名约束如下：
  + 必须以 ASCII 字母开头。
  + 只能包含 ASCII 字母、数字和连字符。
  + 长度必须介于 1 到 255 个字符之间。
  + 不能包含两个连续连字符。
  + 不能以连字符结束。
+ `CacheParameterGroupFamily` – 参数组的引擎和版本系列。例如 `memcached1.4`。
+ `CacheParameterGroupFamily` – 参数组的引擎和版本系列。例如 `redis2.8`。
+ `Description` – 用户提供的参数组描述。

**Example**  
以下示例使用 memcached1.4 系列作为模板来创建名为 *myMem14* 的参数组。  

```
https://elasticache.us-west-2.amazonaws.com/
   ?Action=CreateCacheParameterGroup
   &CacheParameterGroupFamily=memcached1.4
   &CacheParameterGroupName=myMem14
   &Description=My%20first%20parameter%20group
   &SignatureVersion=4
   &SignatureMethod=HmacSHA256
   &Timestamp=20150202T192317Z
   &Version=2015-02-02
   &X-Amz-Credential=<credential>
```
来自此操作的响应应类似如下所示。  

```
<CreateCacheParameterGroupResponse xmlns="http://elasticache.amazonaws.com/doc/2013-06-15/">
  <CreateCacheParameterGroupResult>
    <CacheParameterGroup>
      <CacheParameterGroupName>myMem14</CacheParameterGroupName>
      <CacheParameterGroupFamily>memcached1.4</CacheParameterGroupFamily>
      <Description>My first  parameter group</Description>
    </CacheParameterGroup>
  </CreateCacheParameterGroupResult>
  <ResponseMetadata>
    <RequestId>d8465952-af48-11e0-8d36-859edca6f4b8</RequestId>
  </ResponseMetadata>
</CreateCacheParameterGroupResponse>
```

**Example**  
以下示例使用 redis2.8 系列作为模板来创建名为 *myRed28* 的参数组。  

```
https://elasticache.us-west-2.amazonaws.com/
   ?Action=CreateCacheParameterGroup
   &CacheParameterGroupFamily=redis2.8
   &CacheParameterGroupName=myRed28
   &Description=My%20first%20parameter%20group
   &SignatureVersion=4
   &SignatureMethod=HmacSHA256
   &Timestamp=20150202T192317Z
   &Version=2015-02-02
   &X-Amz-Credential=<credential>
```
来自此操作的响应应类似如下所示。  

```
<CreateCacheParameterGroupResponse xmlns="http://elasticache.amazonaws.com/doc/2013-06-15/">
  <CreateCacheParameterGroupResult>
    <CacheParameterGroup>
      <CacheParameterGroupName>myRed28</CacheParameterGroupName>
      <CacheParameterGroupFamily>redis2.8</CacheParameterGroupFamily>
      <Description>My first parameter group</Description>
    </CacheParameterGroup>
  </CreateCacheParameterGroupResult>
  <ResponseMetadata>
    <RequestId>d8465952-af48-11e0-8d36-859edca6f4b8</RequestId>
  </ResponseMetadata>
</CreateCacheParameterGroupResponse>
```

创建参数组后，它将具有系列的默认值。要更改默认值，您必须修改参数组。有关更多信息，请参阅 [修改 ElastiCache 参数组](ParameterGroups.Modifying.md)。

有关更多信息，请参阅 [https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_CreateCacheParameterGroup.html](https://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/API_CreateCacheParameterGroup.html)。