community.aws.kinesis_stream 模块 – 管理 Kinesis 流。
注意
此模块是 community.aws 集合 (版本 9.0.0) 的一部分。
如果您正在使用 ansible
包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.aws
。您需要其他要求才能使用此模块,请参阅 要求 获取详细信息。
要在 playbook 中使用它,请指定:community.aws.kinesis_stream
。
community.aws 1.0.0 中的新增功能
概要
创建或删除 Kinesis 流。
更新 Kinesis 流的保留期。
更新 Kinesis 流上的标签。
启用/禁用 Kinesis 流上的服务器端加密。
要求
执行此模块的主机需要以下要求。
python >= 3.6
boto3 >= 1.28.0
botocore >= 1.31.0
参数
参数 |
注释 |
---|---|
AWS 访问密钥 ID。 有关访问令牌的更多信息,请参见 AWS 文档 https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys。 也可以使用 aws_access_key 和 profile 选项是互斥的。 为了与 AWS botocore SDK 保持一致,aws_access_key_id 别名在 5.1.0 版本中添加。 ec2_access_key 别名已弃用,将在 2024-12-01 后的某个版本中删除。
|
|
验证 SSL 证书时使用的 CA 证书包的位置。 也可以使用 |
|
用于修改 botocore 配置的字典。 参数可在 AWS 文档中找到 https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config。 |
|
使用 也可以使用 选项
|
|
启用或禁用 Kinesis 流上的加密。 选项
|
|
加密类型。 默认为 选项
|
|
连接到默认 AWS 端点以外的 URL。虽然这可用于连接到其他与 AWS 兼容的服务,但 amazon.aws 和 community.aws 集合仅针对 AWS 进行了测试。 也可以使用 ec2_url 和 s3_url 别名已弃用,将在 2024-12-01 后的某个版本中删除。
|
|
KMS 密钥的 GUID 或别名。 |
|
您正在管理的 Kinesis 流的名称。 |
|
用于身份验证的命名 AWS 配置文件。 有关命名配置文件的更多信息,请参见 AWS 文档 https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html。 也可以使用 profile 选项与 aws_access_key、aws_secret_key 和 security_token 选项互斥。 |
|
要使用的 AWS 区域。 对于 IAM、Route53 和 CloudFront 等全球服务,将忽略 region。 也可以使用 更多信息,请参见 Amazon AWS 文档 http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region。 ec2_region 别名已弃用,将在 2024-12-01 之后的一个版本中移除。 对 |
|
数据记录添加到流后可访问的时间长度(以小时为单位)。 默认保留期为 24 小时,不能少于 24 小时。 最大保留期为 168 小时。 保留期可以在任何时间点修改。 |
|
AWS 密钥。 有关访问令牌的更多信息,请参见 AWS 文档 https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys。 也可以使用 secret_key 和 profile 选项互斥。 aws_secret_access_key 别名在 5.1.0 版本中添加,以与 AWS botocore SDK 保持一致。 ec2_secret_key 别名已弃用,将在 2024-12-01 之后的一个版本中移除。 对 |
|
用于临时凭证的 AWS STS 会话令牌。 有关访问令牌的更多信息,请参见 AWS 文档 https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys。 也可以使用 security_token 和 profile 选项互斥。 别名 aws_session_token 和 session_token 在 3.2.0 版本中添加,参数名称在 6.0.0 版本中从 security_token 重命名为 session_token。 security_token、aws_security_token 和 access_token 别名已弃用,将在 2024-12-01 之后的一个版本中移除。 对 |
|
要在此流中使用的分片数。 当 state=present 时,这是必需的。 |
|
创建或删除 Kinesis 流。 选项
|
|
资源标签字典,格式为: |
|
设置为 强烈建议不要设置 validate_certs=false,可以考虑改为设置 aws_ca_bundle。 选项
|
|
等待操作完成后再返回。 选项
|
|
等待操作完成之前超时的时间(秒)。 默认值: |
备注
注意
注意:对于模块,环境变量和配置文件是从 Ansible 的“主机”上下文读取的,而不是“控制器”上下文。因此,可能需要显式地将文件复制到“主机”。对于查找和连接插件,环境变量和配置文件是从 Ansible 的“控制器”上下文读取的,而不是“主机”上下文。
Ansible 使用的 AWS SDK (boto3) 也可能从 Ansible “主机”上下文中的配置文件(通常为
~/.aws/credentials
)读取凭据和其他设置(例如区域)的默认值。更多信息,请参见 https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html。
示例
# Note: These examples do not set authentication details, see the AWS Guide for details.
# Basic creation example:
- name: Set up Kinesis Stream with 10 shards and wait for the stream to become ACTIVE
community.aws.kinesis_stream:
name: test-stream
shards: 10
wait: true
wait_timeout: 600
register: test_stream
# Basic creation example with tags:
- name: Set up Kinesis Stream with 10 shards, tag the environment, and wait for the stream to become ACTIVE
community.aws.kinesis_stream:
name: test-stream
shards: 10
tags:
Env: development
wait: true
wait_timeout: 600
register: test_stream
# Basic creation example with tags and increase the retention period from the default 24 hours to 48 hours:
- name: Set up Kinesis Stream with 10 shards, tag the environment, increase the retention period and wait for the stream to become ACTIVE
community.aws.kinesis_stream:
name: test-stream
retention_period: 48
shards: 10
tags:
Env: development
wait: true
wait_timeout: 600
register: test_stream
# Basic delete example:
- name: Delete Kinesis Stream test-stream and wait for it to finish deleting.
community.aws.kinesis_stream:
name: test-stream
state: absent
wait: true
wait_timeout: 600
register: test_stream
# Basic enable encryption example:
- name: Encrypt Kinesis Stream test-stream.
community.aws.kinesis_stream:
name: test-stream
state: present
shards: 1
encryption_state: enabled
encryption_type: KMS
key_id: alias/aws/kinesis
wait: true
wait_timeout: 600
register: test_stream
# Basic disable encryption example:
- name: Encrypt Kinesis Stream test-stream.
community.aws.kinesis_stream:
name: test-stream
state: present
shards: 1
encryption_state: disabled
encryption_type: KMS
key_id: alias/aws/kinesis
wait: true
wait_timeout: 600
register: test_stream
返回值
常用的返回值已在 此处 记录,以下是此模块特有的字段
键 |
描述 |
---|---|
Kinesis 流将保留消息的小时数。 返回:当 state == present 时。 示例: |
|
Amazon 资源标识符。 返回:当 state == present 时。 示例: |
|
Kinesis 流的名称。 返回:当 state == present 时。 示例: |
|
Kinesis 流的当前状态。 返回:当 state == present 时。 示例: |
|
包含与 Kinesis 流关联的所有标签的字典。 返回:当 state == present 时。 示例: |