AWS 문서 예제 리포지토리에서 더 많은 SDK
기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
또는 와 PutRecords
AWS SDK 함께 사용 CLI
다음 코드 예제는 PutRecords
의 사용 방법을 보여 줍니다.
- CLI
-
- AWS CLI
-
데이터 스트림에 여러 레코드를 쓰려면
다음
put-records
예제에서는 지정된 파티션 키를 사용하여 데이터 레코드를 작성하고 단일 호출에서 다른 파티션 키를 사용하여 다른 데이터 레코드를 작성합니다.aws kinesis put-records \ --stream-name
samplestream
\ --recordsData=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 내용은 명령 참조PutRecords
의 섹션을 참조하세요. AWS CLI
-
- JavaScript
-
- SDK 용 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 "url"; import { parseArgs } from "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 내용은 참조PutRecords의 섹션을 참조하세요. AWS SDK for JavaScript API
-
PutRecord
RegisterStreamConsumer