Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.
Gen1 DocsLegacy

Page updated May 12, 2026

Amazon Data Firehose

AWS Cloud Development Kit (AWS CDK) を使用して Amazon Data Firehose 配信ストリームを作成し、アプリに必要な権限を付与します。Amplify バックエンドへのカスタム AWS リソースの追加の詳細については、カスタムリソースを参照してください。

Firehose 配信ストリームをセットアップする

amplify/backend.ts
import { defineBackend } from "@aws-amplify/backend";
import { auth } from "./auth/resource";
import { data } from "./data/resource";
import { storage } from "./storage/resource";
import { CfnDeliveryStream } from "aws-cdk-lib/aws-kinesisfirehose";
import { Stack } from "aws-cdk-lib/core";
import {
Policy,
PolicyStatement,
Role,
ServicePrincipal,
} from "aws-cdk-lib/aws-iam";
const backend = defineBackend({
auth,
data,
storage,
});
const firehoseStack = backend.createStack("firehose-stack");
// Access the S3 bucket resource
const s3Bucket = backend.storage.resources.bucket;
// Create a new IAM role for the Firehose
const firehoseRole = new Role(firehoseStack, "FirehoseRole", {
assumedBy: new ServicePrincipal("firehose.amazonaws.com"),
});
// Grant the Firehose role read/write permissions to the S3 bucket
s3Bucket.grantReadWrite(firehoseRole);
// Create a Firehose delivery stream
const myFirehose = new CfnDeliveryStream(firehoseStack, "MyFirehose", {
deliveryStreamType: "DirectPut",
s3DestinationConfiguration: {
bucketArn: s3Bucket.bucketArn,
roleArn: firehoseRole.roleArn,
},
deliveryStreamName: "myFirehose",
});
// Grant PutRecordBatch permission to authenticated users
const firehosePolicy = new Policy(firehoseStack, "FirehosePolicy", {
statements: [
new PolicyStatement({
actions: ["firehose:PutRecordBatch"],
resources: [myFirehose.attrArn],
}),
],
});
backend.auth.resources.authenticatedUserIamRole.attachInlinePolicy(firehosePolicy);

CDK を使用していない場合は、認証済み IAM ロールが対象の配信ストリームに対して firehose:PutRecordBatch 権限を持つことを確認してください。

{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "firehose:PutRecordBatch",
"Resource": "arn:aws:firehose:<region>:<account-id>:deliverystream/<stream-name>"
}]
}

詳細については、Amazon Data Firehose デベロッパーガイドを参照してください。

S3 配信先バケットが適切に保護されていることを確認してください。暗号化、アクセス制御、ログについては、Amazon S3 のセキュリティベストプラクティスを参照してください。

次のステップ

Firehose クライアントを使用してアプリからデータをストリーミングします。