쿠키 기본 설정 선택

당사는 사이트와 서비스를 제공하는 데 필요한 필수 쿠키 및 유사한 도구를 사용합니다. 고객이 사이트를 어떻게 사용하는지 파악하고 개선할 수 있도록 성능 쿠키를 사용해 익명의 통계를 수집합니다. 필수 쿠키는 비활성화할 수 없지만 '사용자 지정' 또는 ‘거부’를 클릭하여 성능 쿠키를 거부할 수 있습니다.

사용자가 동의하는 경우 AWS와 승인된 제3자도 쿠키를 사용하여 유용한 사이트 기능을 제공하고, 사용자의 기본 설정을 기억하고, 관련 광고를 비롯한 관련 콘텐츠를 표시합니다. 필수가 아닌 모든 쿠키를 수락하거나 거부하려면 ‘수락’ 또는 ‘거부’를 클릭하세요. 더 자세한 내용을 선택하려면 ‘사용자 정의’를 클릭하세요.

또는와 PutRecordsAWS SDK 함께 사용 CLI

포커스 모드
또는와 PutRecordsAWS SDK 함께 사용 CLI - Amazon Kinesis Data Streams

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

다음 코드 예제는 PutRecords의 사용 방법을 보여 줍니다.

CLI
AWS CLI

데이터 스트림에 여러 레코드를 쓰려면

다음 put-records 예제에서는 단일 직접 호출에서 지정된 파티션 키를 사용하여 데이터 레코드를 쓰고 다른 파티션 키를 사용하여 또 하나의 데이터 레코드를 씁니다.

aws kinesis put-records \ --stream-name samplestream \ --records Data=blob1,PartitionKey=partitionkey1 Data=blob2,PartitionKey=partitionkey2

출력:

{ "FailedRecordCount": 0, "Records": [ { "SequenceNumber": "49600883331171471519674795588238531498465399900093808706", "ShardId": "shardId-000000000004" }, { "SequenceNumber": "49600902273357540915989931256902715169698037101720764562", "ShardId": "shardId-000000000009" } ], "EncryptionType": "KMS" }

자세한 내용은 Amazon Kinesis Data Streams 개발자 안내서의 Java용 API에서 AWS SDK Amazon Kinesis Data Streams를 사용하여 생산자 개발을 참조하세요. Amazon Kinesis

  • 자세한 API 내용은 AWS CLI 명령 참조PutRecords의 섹션을 참조하세요.

JavaScript
SDK for JavaScript (v3)
참고

더 많은 기능이 있습니다 GitHub. AWS 코드 예시 리포지토리에서 전체 예시를 찾고 설정 및 실행하는 방법을 배워보세요.

import { PutRecordsCommand, KinesisClient } from "@aws-sdk/client-kinesis"; /** * Put multiple records into a Kinesis stream. * @param {{ streamArn: string }} config */ export const main = async ({ streamArn }) => { const client = new KinesisClient({}); try { await client.send( new PutRecordsCommand({ StreamARN: streamArn, Records: [ { Data: new Uint8Array(), /** * Determines which shard in the stream the data record is assigned to. * Partition keys are Unicode strings with a maximum length limit of 256 * characters for each key. Amazon Kinesis Data Streams uses the partition * key as input to a hash function that maps the partition key and * associated data to a specific shard. */ PartitionKey: "TEST_KEY", }, { Data: new Uint8Array(), PartitionKey: "TEST_KEY", }, ], }), ); } catch (caught) { if (caught instanceof Error) { // } else { throw caught; } } }; // Call function if run directly. import { fileURLToPath } from "node:url"; import { parseArgs } from "node:util"; if (process.argv[1] === fileURLToPath(import.meta.url)) { const options = { streamArn: { type: "string", description: "The ARN of the stream.", }, }; const { values } = parseArgs({ options }); main(values); }
  • API 자세한 내용은 AWS SDK for JavaScript API 참조PutRecords의 섹션을 참조하세요.

AWS CLI

데이터 스트림에 여러 레코드를 쓰려면

다음 put-records 예제에서는 단일 직접 호출에서 지정된 파티션 키를 사용하여 데이터 레코드를 쓰고 다른 파티션 키를 사용하여 또 하나의 데이터 레코드를 씁니다.

aws kinesis put-records \ --stream-name samplestream \ --records Data=blob1,PartitionKey=partitionkey1 Data=blob2,PartitionKey=partitionkey2

출력:

{ "FailedRecordCount": 0, "Records": [ { "SequenceNumber": "49600883331171471519674795588238531498465399900093808706", "ShardId": "shardId-000000000004" }, { "SequenceNumber": "49600902273357540915989931256902715169698037101720764562", "ShardId": "shardId-000000000009" } ], "EncryptionType": "KMS" }

자세한 내용은 Amazon Kinesis Data Streams 개발자 안내서의 Java용 API에서 AWS SDK Amazon Kinesis Data Streams를 사용하여 생산자 개발을 참조하세요. Amazon Kinesis

  • 자세한 API 내용은 AWS CLI 명령 참조PutRecords의 섹션을 참조하세요.

개발자 안내서 및 코드 예제의 AWS SDK 전체 목록은 섹션을 참조하세요AWS SDK에서이 서비스 사용. 이 주제에는 시작하기에 대한 정보와 이전 SDK 버전에 대한 세부 정보도 포함되어 있습니다.

프라이버시사이트 이용 약관쿠키 기본 설정
© 2025, Amazon Web Services, Inc. 또는 계열사. All rights reserved.