

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

# 入门 Amazon Transcribe
<a name="getting-started"></a>

在创建转录之前，您需要满足以下几个先决条件：
+ [注册一个 AWS 账户](#getting-started-sign-up) 
+ [安装 AWS CLI 和 SDKs](#getting-started-api)（如果您使用进行转录，则可以跳过此步骤） AWS 管理控制台 
+ [配置 IAM 凭证](#getting-started-iam)
+ [设置 Amazon S3 存储桶](#getting-started-s3)
+ [创建 IAM 策略](#getting-started-policy)

完成这些先决条件后，您就可以进行转录了。从以下列表中选择您的首选转录方法开始转录。
+ [AWS CLI](getting-started-cli.md)
+ [AWS 管理控制台](getting-started-console.md)
+ [AWS SDK](getting-started-sdk.md)
+ [HTTP](getting-started-http-websocket.md)
+ [WebSockets](getting-started-http-websocket.md)

**提示**  
如果您不熟悉 Amazon Transcribe 或想探索我们的功能，我们建议您使用 [AWS 管理控制台](https://console.aws.amazon.com/transcribe). 如果您想使用计算机麦克风启动音频流，这也是最简单的选择。

由于使用 HTTP/2 进行流式传输比其他转录方法更复杂，因此我们建议您在开始使用这些方法之前先阅读[设置流式转录](streaming-setting-up.md)本节。 WebSockets **请注意，我们强烈建议使用 SDK 进行流式转录。**

## 报名参加 AWS 账户
<a name="getting-started-sign-up"></a>

您可以注册[免费套餐](https://aws.amazon.com/free/)账户或[付费账户](https://portal.aws.amazon.com/gp/aws/developer/registration/index.html)。这两个选项都允许您访问所有内容 AWS 服务。免费套餐有试用期，在此期间，您可以探索 AWS 服务 和估算使用情况。试用期到期后，您可以迁移到付费账户。费用是按需计费的；详情请参阅[Amazon Transcribe 定价](https://aws.amazon.com/transcribe/pricing/)。 pay-as-you-use

**提示**  
在设置账户时，请记下你的 AWS 账户 ID，因为你需要用它来创建 IAM 实体。

## 安装 AWS CLI 和 SDKs
<a name="getting-started-api"></a>

要使用 Amazon Transcribe API，必须先安装 AWS CLI。当前 AWS CLI 版本为 2。您可以在 [https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) 中找到 [Linux](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html)、[Mac](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html)、[Windows](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-windows.html) 和 [Docker](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-docker.html) 的安装说明。

 AWS CLI 安装完成后，必须将其[配置](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)为安全凭证和 AWS 区域。

如果您想与 SDK Amazon Transcribe 一起使用，请选择您的首选语言以获取安装说明：
+ [.NET](https://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/quick-start.html)
+ [C\+\+](https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/getting-started.html)
+ [Go](https://aws.github.io/aws-sdk-go-v2/docs/)
+ [Java V2](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/setup.html)
+ [JavaScript](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/getting-started.html)
+ [PHP V3](https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/getting-started_installation.html)
+ [适用于 Python (Boto3) 的 AWS SDK](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html)（批量转录）
+ [Python](https://github.com/awslabs/amazon-transcribe-streaming-sdk)（流式转录）
+ [Ruby V3](https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-install.html)
+ [Rust](https://crates.io/crates/aws-sdk-transcribe)（批量转录）
+ [Rust](https://crates.io/crates/aws-sdk-transcribestreaming)（流式转录）

## 配置 IAM 凭证
<a name="getting-started-iam"></a>

创建时 AWS 账户，您首先要有一个登录身份，该身份可以完全访问您账户中的所有 AWS 服务和资源。此身份被称为 AWS 账户 root 用户，使用您创建账户时使用的电子邮件地址和密码登录即可访问该身份。

强烈建议您不要使用根用户执行日常任务。保护好根用户凭证，并使用这些凭证来执行仅根用户可以执行的任务。

作为最佳实践，要求用户（包括需要管理员访问权限的用户）使用与身份提供商的联合身份验证通过临时证书访问 AWS 服务。

联合身份是使用通过身份源提供的凭证访问 AWS 服务的任何用户。当联合身份访问 AWS 账户时，他们代入角色，而角色提供临时凭证。

要集中管理访问权限，建议您使用 [AWS IAM Identity Center](https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html)。您可以在 IAM Identity Center中创建用户和组。或者，您可以连接到自己的身份源中的一组用户和群组并进行同步，以便在所有 AWS 账户 和应用程序中使用。有关更多信息，请参阅 [适用于 Identity and Access Managem Amazon Transcribe](security-iam.md)。

要了解有关 IAM 最佳做法的更多信息，请参阅[中的安全最佳实践 IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)。

## 创建 Amazon S3 存储桶
<a name="getting-started-s3"></a>

Amazon S3 是一项安全的对象存储服务。 Amazon S3 将您的文件（称为*对象*）存储在容器（称为*存储桶*）中。

要运行批量转录，必须先将媒体文件上传到 Amazon S3 存储桶中。如果您没有为转录输出指定 Amazon S3 存储桶，请将您的成绩单 Amazon Transcribe 放在临时 AWS托管存储桶中。 Amazon S3 存储桶中的转录输出 AWS将在 90 天后自动删除。

了解如何[创建您的第一个 S3 存储桶](https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-bucket.html)和[对象上传到您的存储桶](https://docs.aws.amazon.com/AmazonS3/latest/userguide/uploading-an-object-bucket.html)。

## 创建 IAM 策略
<a name="getting-started-policy"></a>

要在中管理访问权限 AWS，必须创建策略并将其附加到 IAM 身份（用户、组或角色）或 AWS 资源。策略定义了它所附加到的实体的权限。例如，如果您已向该角色附加了授予访问权限的策略，则该角色只能访问该 Amazon S3 存储桶中的媒体文件。如果您想进一步限制该角色，则可以改为限制其对 Amazon S3 存储桶内特定文件的访问权限。

要了解有关使用 AWS 策略的更多信息，请参阅：
+ [中的策略和权限 IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html)
+ [创建 IAM 策略](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html)
+ [如何 Amazon Transcribe 与 IAM 配合使用](security_iam_service-with-iam.md)

有关可以与配合使用的策略示例 Amazon Transcribe，请参阅[Amazon Transcribe 基于身份的策略示例](security_iam_id-based-policy-examples.md)。如果要生成自定义策略，请考虑使用 [AWS 策略生成器](https://awspolicygen.s3.amazonaws.com/policygen.html)。

您可以使用 AWS 管理控制台 AWS CLI、或 AWS SDK 添加策略。有关说明，请参阅[添加和删除 IAM 身份权限](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html#add-policy-api)。

策略的格式为：

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "{{my-policy-name}}",
            "Effect": "Allow",
            "Action": [
                "{{service}}:{{action}}"
            ],
            "Resource": [
                "{{amazon-resource-name}}"
            ]
        }
    ]
}
```

------

Amazon 资源名称 (ARNs) 唯一标识所有 AWS 资源，例如 Amazon S3 存储桶。您可以在策略 ARNs 中使用来授予使用特定资源的特定操作的权限。例如，如果您想授予对 Amazon S3 存储桶及其子文件夹的读取权限，则可以在信任策略的`Statement`部分中添加以下代码：

```
{
        "Effect": "Allow",
        "Action": [
            "s3:GetObject",
            "s3:ListBucket"
        ],
        "Resource": [
            "arn:aws:s3:::{{amzn-s3-demo-bucket}}",
            "arn:aws:s3:::{{amzn-s3-demo-bucket/*}}"
        ]
}
```

以下是向 Amazon S3 存储桶及其子文件夹授予 Amazon Transcribe 读取 (`GetObject`、`ListBucket``PutObject`) 和写入 () 权限的策略示例：`amzn-s3-demo-bucket`

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:ListBucket"
            ],
            "Resource": [
                "arn:aws:s3:::{{amzn-s3-demo-bucket}}",
                "arn:aws:s3:::{{amzn-s3-demo-bucket/*}}"
            ]
        },
        {
             "Effect": "Allow",
             "Action": [
                 "s3:PutObject"
             ],
             "Resource": [
                 "arn:aws:s3:::{{amzn-s3-demo-bucket}}",
                 "arn:aws:s3:::{{amzn-s3-demo-bucket/*}}"
             ]
        }
  ]
}
```

------