Sono disponibili altri esempi AWS SDK nel repository AWS Doc SDK
Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Esempi di QLDB che utilizzano AWS CLI
I seguenti esempi di codice mostrano come eseguire azioni e implementare scenari comuni utilizzando AWS Command Line Interface with QLDB.
Le operazioni sono estratti di codice da programmi più grandi e devono essere eseguite nel contesto. Sebbene le operazioni mostrino come richiamare le singole funzioni del servizio, è possibile visualizzarle contestualizzate negli scenari correlati.
Ogni esempio include un collegamento al codice sorgente completo, in cui è possibile trovare istruzioni su come configurare ed eseguire il codice nel contesto.
Argomenti
Azioni
Il seguente esempio di codice mostra come utilizzarecancel-journal-kinesis-stream.
- AWS CLI
-
Per annullare lo streaming di un diario
L'
cancel-journal-kinesis-streamesempio seguente annulla lo stream di journal specificato da un libro mastro.aws qldb cancel-journal-kinesis-stream \ --ledger-namemyExampleLedger\ --stream-id7ISCkqwe4y25YyHLzYUFAfOutput:
{ "StreamId": "7ISCkqwe4y25YyHLzYUFAf" }Per ulteriori informazioni, consulta Streaming dei dati del journal da Amazon QLDB nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta CancelJournalKinesisStream
Command Reference.AWS CLI
-
Il seguente esempio di codice mostra come utilizzarecreate-ledger.
- AWS CLI
-
Esempio 1: creare un libro mastro con proprietà predefinite
L'
create-ledgeresempio seguente crea un libro mastro con il nomemyExampleLedgere la modalità di autorizzazione.STANDARDI parametri opzionali per la protezione dall'eliminazione e la chiave AWS KMS non sono specificati, quindi per impostazione predefinita sonotruerispettivamente una chiave KMS AWS proprietaria.aws qldb create-ledger \ --namemyExampleLedger\ --permissions-modeSTANDARDOutput:
{ "State": "CREATING", "Arn": "arn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger", "DeletionProtection": true, "CreationDateTime": 1568839243.951, "Name": "myExampleLedger", "PermissionsMode": "STANDARD" }Esempio 2: creare un registro con la protezione da eliminazione disattivata, una chiave KMS gestita dal cliente e tag specificati
L'
create-ledgeresempio seguente crea un libro mastro con il nomemyExampleLedger2e la modalità di autorizzazione.STANDARDLa funzionalità di protezione dall'eliminazione è disattivata, la chiave KMS gestita dal cliente specificata viene utilizzata per la crittografia a riposo e i tag specificati vengono allegati alla risorsa.aws qldb create-ledger \ --namemyExampleLedger2\ --permissions-modeSTANDARD\ --no-deletion-protection \ --kms-keyarn:aws:kms:us-west-2:123456789012:key/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111\ --tagsIsTest=true,Domain=TestOutput:
{ "Arn": "arn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger2", "DeletionProtection": false, "CreationDateTime": 1568839543.557, "State": "CREATING", "Name": "myExampleLedger2", "PermissionsMode": "STANDARD", "KmsKeyArn": "arn:aws:kms:us-west-2:123456789012:key/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }Per ulteriori informazioni, consulta Basic Operations for Amazon QLDB Ledgers nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta Command Reference. CreateLedger
AWS CLI
-
Il seguente esempio di codice mostra come utilizzaredelete-ledger.
- AWS CLI
-
Per eliminare un libro mastro
L'
delete-ledgeresempio seguente elimina il libro mastro specificato.aws qldb delete-ledger \ --namemyExampleLedgerQuesto comando non produce alcun output.
Per ulteriori informazioni, consulta Basic Operations for Amazon QLDB Ledgers nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta Command Reference. DeleteLedger
AWS CLI
-
Il seguente esempio di codice mostra come utilizzaredescribe-journal-kinesis-stream.
- AWS CLI
-
Per descrivere lo stream di un diario
L'
describe-journal-kinesis-streamesempio seguente visualizza i dettagli per il flusso di journal specificato da un libro mastro.aws qldb describe-journal-kinesis-stream \ --ledger-namemyExampleLedger\ --stream-id7ISCkqwe4y25YyHLzYUFAfOutput:
{ "Stream": { "LedgerName": "myExampleLedger", "CreationTime": 1591221984.677, "InclusiveStartTime": 1590710400.0, "ExclusiveEndTime": 1590796799.0, "RoleArn": "arn:aws:iam::123456789012:role/my-kinesis-stream-role", "StreamId": "7ISCkqwe4y25YyHLzYUFAf", "Arn": "arn:aws:qldb:us-east-1:123456789012:stream/myExampleLedger/7ISCkqwe4y25YyHLzYUFAf", "Status": "ACTIVE", "KinesisConfiguration": { "StreamArn": "arn:aws:kinesis:us-east-1:123456789012:stream/stream-for-qldb", "AggregationEnabled": true }, "StreamName": "myExampleLedger-stream" } }Per ulteriori informazioni, consulta Streaming dei dati del journal da Amazon QLDB nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta DescribeJournalKinesisStream
Command Reference.AWS CLI
-
Il seguente esempio di codice mostra come utilizzaredescribe-journal-s3-export.
- AWS CLI
-
Per descrivere un processo di esportazione di un diario
L'
describe-journal-s3-exportesempio seguente visualizza i dettagli del processo di esportazione specificato da un libro mastro.aws qldb describe-journal-s3-export \ --namemyExampleLedger\ --export-idADR2ONPKN5LINYGb4dp7yZOutput:
{ "ExportDescription": { "S3ExportConfiguration": { "Bucket": "amzn-s3-demo-bucket", "Prefix": "ledgerexport1/", "EncryptionConfiguration": { "ObjectEncryptionType": "SSE_S3" } }, "RoleArn": "arn:aws:iam::123456789012:role/my-s3-export-role", "Status": "COMPLETED", "ExportCreationTime": 1568847801.418, "InclusiveStartTime": 1568764800.0, "ExclusiveEndTime": 1568847599.0, "LedgerName": "myExampleLedger", "ExportId": "ADR2ONPKN5LINYGb4dp7yZ" } }Per ulteriori informazioni, consulta Exporting Your Journal in Amazon QLDB nella Amazon QLDB Developer Guide.
Il seguente esempio di codice mostra come usare. describe-ledger
- AWS CLI
-
Per descrivere un libro mastro
L'
describe-ledgeresempio seguente visualizza i dettagli del libro contabile specificato.aws qldb describe-ledger \ --namemyExampleLedgerOutput:
{ "CreationDateTime": 1568839243.951, "Arn": "arn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger", "State": "ACTIVE", "Name": "myExampleLedger", "DeletionProtection": true, "PermissionsMode": "STANDARD", "EncryptionDescription": { "KmsKeyArn": "arn:aws:kms:us-west-2:123456789012:key/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "EncryptionStatus": "ENABLED" } }Per ulteriori informazioni, consulta Basic Operations for Amazon QLDB Ledgers nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta Command Reference. DescribeLedger
AWS CLI
-
Il seguente esempio di codice mostra come utilizzareexport-journal-to-s3.
- AWS CLI
-
Per esportare blocchi di journal in S3
L'
export-journal-to-s3esempio seguente crea un processo di esportazione per i blocchi di diario entro un intervallo di data e ora specificato da un registro con il nome.myExampleLedgerIl processo di esportazione scrive i blocchi in un bucket Amazon S3 specificato.aws qldb export-journal-to-s3 \ --namemyExampleLedger\ --inclusive-start-time2019-09-18T00:00:00Z\ --exclusive-end-time2019-09-18T22:59:59Z\ --role-arnarn:aws:iam::123456789012:role/my-s3-export-role\ --s3-export-configurationfile://my-s3-export-config.jsonContenuto di
my-s3-export-config.json.{ "Bucket": "amzn-s3-demo-bucket", "Prefix": "ledgerexport1/", "EncryptionConfiguration": { "ObjectEncryptionType": "SSE_S3" } }Output:
{ "ExportId": "ADR2ONPKN5LINYGb4dp7yZ" }Per ulteriori informazioni, consulta Exporting Your Journal in Amazon QLDB nella Amazon QLDB Developer Guide.
Il seguente esempio di codice mostra come usareget-block.
- AWS CLI
-
Esempio 1: Per ottenere un blocco di diario e una bozza per la verifica utilizzando i file di input
L'
get-blockesempio seguente richiede un oggetto di dati a blocchi e una bozza dal registro specificato. La richiesta riguarda un indirizzo digest tip e un indirizzo di blocco specificati.aws qldb get-block \ --namevehicle-registration\ --block-addressfile://myblockaddress.json\ --digest-tip-addressfile://mydigesttipaddress.jsonContenuto di
myblockaddress.json.{ "IonText": "{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:100}" }Contenuto di
mydigesttipaddress.json.{ "IonText": "{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:123}" }Output:
{ "Block": { "IonText": "{blockAddress:{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:100},transactionId:\"FnQeJBAicTX0Ah32ZnVtSX\",blockTimestamp:2019-09-16T19:37:05.360Z,blockHash:{{NoChM92yKRuJAb/jeLd1VnYn4DHiWIf071ACfic9uHc=}},entriesHash:{{l05LOsiKV14SDbuaYnH7uwXzUvqzIwUiRLXGbTyj/nY=}},previousBlockHash:{{7kewBXhpdbClcZKxhVmpoMHpUGOJtWQD0iY2LPfZkYA=}},entriesHashList:[{{eRSwnmAM7WWANWDd5iGOyK+T4tDXyzUq6HZ/0fgLHos=}},{{mHVex/yjHAWjFPpwhBuH2GKXmKJjK2FBa9faqoUVNtg=}},{{y5cCBr7pOAIUfsVQ1j0TqtE97b4b4oo1R0vnYyE5wWM=}},{{TvTXygML1bMe6NvEZtGkX+KR+W/EJl4qD1mmV77KZQg=}}],transactionInfo:{statements:[{statement:\"FROM VehicleRegistration AS r \\nWHERE r.VIN = '1N4AL11D75C109151'\\nINSERT INTO r.Owners.SecondaryOwners\\n VALUE { 'PersonId' : 'CMVdR77XP8zAglmmFDGTvt' }\",startTime:2019-09-16T19:37:05.302Z,statementDigest:{{jcgPX2vsOJ0waum4qmDYtn1pCAT9xKNIzA+2k4R+mxA=}}}],documents:{JUJgkIcNbhS2goq8RqLuZ4:{tableName:\"VehicleRegistration\",tableId:\"BFJKdXgzt9oF4wjMbuxy4G\",statements:[0]}}},revisions:[{blockAddress:{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:100},hash:{{mHVex/yjHAWjFPpwhBuH2GKXmKJjK2FBa9faqoUVNtg=}},data:{VIN:\"1N4AL11D75C109151\",LicensePlateNumber:\"LEWISR261LL\",State:\"WA\",PendingPenaltyTicketAmount:90.25,ValidFromDate:2017-08-21,ValidToDate:2020-05-11,Owners:{PrimaryOwner:{PersonId:\"BFJKdXhnLRT27sXBnojNGW\"},SecondaryOwners:[{PersonId:\"CMVdR77XP8zAglmmFDGTvt\"}]},City:\"Everett\"},metadata:{id:\"JUJgkIcNbhS2goq8RqLuZ4\",version:3,txTime:2019-09-16T19:37:05.344Z,txId:\"FnQeJBAicTX0Ah32ZnVtSX\"}}]}" }, "Proof": { "IonText": "[{{l3+EXs69K1+rehlqyWLkt+oHDlw4Zi9pCLW/t/mgTPM=}},{{48CXG3ehPqsxCYd34EEa8Fso0ORpWWAO8010RJKf3Do=}},{{9UnwnKSQT0i3ge1JMVa+tMIqCEDaOPTkWxmyHSn8UPQ=}},{{3nW6Vryghk+7pd6wFCtLufgPM6qXHyTNeCb1sCwcDaI=}},{{Irb5fNhBrNEQ1VPhzlnGT/ZQPadSmgfdtMYcwkNOxoI=}},{{+3CWpYG/ytf/vq9GidpzSx6JJiLXt1hMQWNnqOy3jfY=}},{{NPx6cRhwsiy5m9UEWS5JTJrZoUdO2jBOAAOmyZAT+qE=}}]" } }Per ulteriori informazioni, consulta la sezione Verifica dei dati in Amazon QLDB nella Amazon QLDB Developer Guide.
Esempio 2: ottenere un blocco del diario e una bozza per la verifica utilizzando una sintassi abbreviata
L'
get-blockesempio seguente richiede un oggetto di dati a blocchi e una bozza dal registro specificato utilizzando una sintassi abbreviata. La richiesta riguarda un indirizzo digest tip e un indirizzo di blocco specificati.aws qldb get-block \ --namevehicle-registration\ --block-address 'IonText="{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:100}"' \ --digest-tip-address 'IonText="{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:123}"'Output:
{ "Block": { "IonText": "{blockAddress:{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:100},transactionId:\"FnQeJBAicTX0Ah32ZnVtSX\",blockTimestamp:2019-09-16T19:37:05.360Z,blockHash:{{NoChM92yKRuJAb/jeLd1VnYn4DHiWIf071ACfic9uHc=}},entriesHash:{{l05LOsiKV14SDbuaYnH7uwXzUvqzIwUiRLXGbTyj/nY=}},previousBlockHash:{{7kewBXhpdbClcZKxhVmpoMHpUGOJtWQD0iY2LPfZkYA=}},entriesHashList:[{{eRSwnmAM7WWANWDd5iGOyK+T4tDXyzUq6HZ/0fgLHos=}},{{mHVex/yjHAWjFPpwhBuH2GKXmKJjK2FBa9faqoUVNtg=}},{{y5cCBr7pOAIUfsVQ1j0TqtE97b4b4oo1R0vnYyE5wWM=}},{{TvTXygML1bMe6NvEZtGkX+KR+W/EJl4qD1mmV77KZQg=}}],transactionInfo:{statements:[{statement:\"FROM VehicleRegistration AS r \\nWHERE r.VIN = '1N4AL11D75C109151'\\nINSERT INTO r.Owners.SecondaryOwners\\n VALUE { 'PersonId' : 'CMVdR77XP8zAglmmFDGTvt' }\",startTime:2019-09-16T19:37:05.302Z,statementDigest:{{jcgPX2vsOJ0waum4qmDYtn1pCAT9xKNIzA+2k4R+mxA=}}}],documents:{JUJgkIcNbhS2goq8RqLuZ4:{tableName:\"VehicleRegistration\",tableId:\"BFJKdXgzt9oF4wjMbuxy4G\",statements:[0]}}},revisions:[{blockAddress:{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:100},hash:{{mHVex/yjHAWjFPpwhBuH2GKXmKJjK2FBa9faqoUVNtg=}},data:{VIN:\"1N4AL11D75C109151\",LicensePlateNumber:\"LEWISR261LL\",State:\"WA\",PendingPenaltyTicketAmount:90.25,ValidFromDate:2017-08-21,ValidToDate:2020-05-11,Owners:{PrimaryOwner:{PersonId:\"BFJKdXhnLRT27sXBnojNGW\"},SecondaryOwners:[{PersonId:\"CMVdR77XP8zAglmmFDGTvt\"}]},City:\"Everett\"},metadata:{id:\"JUJgkIcNbhS2goq8RqLuZ4\",version:3,txTime:2019-09-16T19:37:05.344Z,txId:\"FnQeJBAicTX0Ah32ZnVtSX\"}}]}" }, "Proof": { "IonText": "[{{l3+EXs69K1+rehlqyWLkt+oHDlw4Zi9pCLW/t/mgTPM=}},{{48CXG3ehPqsxCYd34EEa8Fso0ORpWWAO8010RJKf3Do=}},{{9UnwnKSQT0i3ge1JMVa+tMIqCEDaOPTkWxmyHSn8UPQ=}},{{3nW6Vryghk+7pd6wFCtLufgPM6qXHyTNeCb1sCwcDaI=}},{{Irb5fNhBrNEQ1VPhzlnGT/ZQPadSmgfdtMYcwkNOxoI=}},{{+3CWpYG/ytf/vq9GidpzSx6JJiLXt1hMQWNnqOy3jfY=}},{{NPx6cRhwsiy5m9UEWS5JTJrZoUdO2jBOAAOmyZAT+qE=}}]" } }Per ulteriori informazioni, consulta la sezione Verifica dei dati in Amazon QLDB nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta GetBlock
Command Reference.AWS CLI
-
Il seguente esempio di codice mostra come utilizzareget-digest.
- AWS CLI
-
Per ottenere un riassunto di un libro mastro
L'
get-digestesempio seguente richiede un digest dal registro specificato all'ultimo blocco commesso nel diario.aws qldb get-digest \ --namevehicle-registrationOutput:
{ "Digest": "6m6BMXobbJKpMhahwVthAEsN6awgnHK62Qq5McGP1Gk=", "DigestTipAddress": { "IonText": "{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:123}" } }Per ulteriori informazioni, consulta la sezione Verifica dei dati in Amazon QLDB nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta GetDigest
Command Reference.AWS CLI
-
Il seguente esempio di codice mostra come utilizzareget-revision.
- AWS CLI
-
Esempio 1: Per ottenere la revisione di un documento e una prova per la verifica utilizzando file di input
L'
get-revisionesempio seguente richiede un oggetto di dati di revisione e una bozza dal registro specificato. La richiesta riguarda un indirizzo digest tip, un ID del documento e un indirizzo di blocco della revisione specificati.aws qldb get-revision \ --namevehicle-registration\ --block-addressfile://myblockaddress.json\ --document-idJUJgkIcNbhS2goq8RqLuZ4\ --digest-tip-addressfile://mydigesttipaddress.jsonContenuto di
myblockaddress.json.{ "IonText": "{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:100}" }Contenuto di
mydigesttipaddress.json.{ "IonText": "{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:123}" }Output:
{ "Revision": { "IonText": "{blockAddress:{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:100},hash:{{mHVex/yjHAWjFPpwhBuH2GKXmKJjK2FBa9faqoUVNtg=}},data:{VIN:\"1N4AL11D75C109151\",LicensePlateNumber:\"LEWISR261LL\",State:\"WA\",PendingPenaltyTicketAmount:90.25,ValidFromDate:2017-08-21,ValidToDate:2020-05-11,Owners:{PrimaryOwner:{PersonId:\"BFJKdXhnLRT27sXBnojNGW\"},SecondaryOwners:[{PersonId:\"CMVdR77XP8zAglmmFDGTvt\"}]},City:\"Everett\"},metadata:{id:\"JUJgkIcNbhS2goq8RqLuZ4\",version:3,txTime:2019-09-16T19:37:05.344Z,txId:\"FnQeJBAicTX0Ah32ZnVtSX\"}}" }, "Proof": { "IonText": "[{{eRSwnmAM7WWANWDd5iGOyK+T4tDXyzUq6HZ/0fgLHos=}},{{VV1rdaNuf+yJZVGlmsM6gr2T52QvBO8Lg+KgpjcnWAU=}},{{7kewBXhpdbClcZKxhVmpoMHpUGOJtWQD0iY2LPfZkYA=}},{{l3+EXs69K1+rehlqyWLkt+oHDlw4Zi9pCLW/t/mgTPM=}},{{48CXG3ehPqsxCYd34EEa8Fso0ORpWWAO8010RJKf3Do=}},{{9UnwnKSQT0i3ge1JMVa+tMIqCEDaOPTkWxmyHSn8UPQ=}},{{3nW6Vryghk+7pd6wFCtLufgPM6qXHyTNeCb1sCwcDaI=}},{{Irb5fNhBrNEQ1VPhzlnGT/ZQPadSmgfdtMYcwkNOxoI=}},{{+3CWpYG/ytf/vq9GidpzSx6JJiLXt1hMQWNnqOy3jfY=}},{{NPx6cRhwsiy5m9UEWS5JTJrZoUdO2jBOAAOmyZAT+qE=}}]" } }Per ulteriori informazioni, consulta la sezione Verifica dei dati in Amazon QLDB nella Amazon QLDB Developer Guide.
Esempio 2: per ottenere la revisione di un documento e una prova per la verifica utilizzando una sintassi abbreviata
L'
get-revisionesempio seguente richiede un oggetto di dati di revisione e una bozza dal registro specificato utilizzando una sintassi abbreviata. La richiesta riguarda un indirizzo digest tip, un ID del documento e un indirizzo di blocco della revisione specificati.aws qldb get-revision \ --namevehicle-registration\ --block-address 'IonText="{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:100}"' \ --document-idJUJgkIcNbhS2goq8RqLuZ4\ --digest-tip-address 'IonText="{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:123}"'Output:
{ "Revision": { "IonText": "{blockAddress:{strandId:\"KmA3ZZca7vAIiJAK9S5Iwl\",sequenceNo:100},hash:{{mHVex/yjHAWjFPpwhBuH2GKXmKJjK2FBa9faqoUVNtg=}},data:{VIN:\"1N4AL11D75C109151\",LicensePlateNumber:\"LEWISR261LL\",State:\"WA\",PendingPenaltyTicketAmount:90.25,ValidFromDate:2017-08-21,ValidToDate:2020-05-11,Owners:{PrimaryOwner:{PersonId:\"BFJKdXhnLRT27sXBnojNGW\"},SecondaryOwners:[{PersonId:\"CMVdR77XP8zAglmmFDGTvt\"}]},City:\"Everett\"},metadata:{id:\"JUJgkIcNbhS2goq8RqLuZ4\",version:3,txTime:2019-09-16T19:37:05.344Z,txId:\"FnQeJBAicTX0Ah32ZnVtSX\"}}" }, "Proof": { "IonText": "[{{eRSwnmAM7WWANWDd5iGOyK+T4tDXyzUq6HZ/0fgLHos=}},{{VV1rdaNuf+yJZVGlmsM6gr2T52QvBO8Lg+KgpjcnWAU=}},{{7kewBXhpdbClcZKxhVmpoMHpUGOJtWQD0iY2LPfZkYA=}},{{l3+EXs69K1+rehlqyWLkt+oHDlw4Zi9pCLW/t/mgTPM=}},{{48CXG3ehPqsxCYd34EEa8Fso0ORpWWAO8010RJKf3Do=}},{{9UnwnKSQT0i3ge1JMVa+tMIqCEDaOPTkWxmyHSn8UPQ=}},{{3nW6Vryghk+7pd6wFCtLufgPM6qXHyTNeCb1sCwcDaI=}},{{Irb5fNhBrNEQ1VPhzlnGT/ZQPadSmgfdtMYcwkNOxoI=}},{{+3CWpYG/ytf/vq9GidpzSx6JJiLXt1hMQWNnqOy3jfY=}},{{NPx6cRhwsiy5m9UEWS5JTJrZoUdO2jBOAAOmyZAT+qE=}}]" } }Per ulteriori informazioni, consulta la sezione Verifica dei dati in Amazon QLDB nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta GetRevision
Command Reference.AWS CLI
-
Il seguente esempio di codice mostra come utilizzarelist-journal-kinesis-streams-for-ledger.
- AWS CLI
-
Per elencare i flussi di diario per un libro mastro
L'
list-journal-kinesis-streams-for-ledgeresempio seguente elenca i flussi di giornale per il libro mastro specificato.aws qldb list-journal-kinesis-streams-for-ledger \ --ledger-namemyExampleLedgerOutput:
{ "Streams": [ { "LedgerName": "myExampleLedger", "CreationTime": 1591221984.677, "InclusiveStartTime": 1590710400.0, "ExclusiveEndTime": 1590796799.0, "RoleArn": "arn:aws:iam::123456789012:role/my-kinesis-stream-role", "StreamId": "7ISCkqwe4y25YyHLzYUFAf", "Arn": "arn:aws:qldb:us-east-1:123456789012:stream/myExampleLedger/7ISCkqwe4y25YyHLzYUFAf", "Status": "ACTIVE", "KinesisConfiguration": { "StreamArn": "arn:aws:kinesis:us-east-1:123456789012:stream/stream-for-qldb", "AggregationEnabled": true }, "StreamName": "myExampleLedger-stream" } ] }Per ulteriori informazioni, consulta Streaming dei dati del journal da Amazon QLDB nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta ListJournalKinesisStreamsForLedger
Command Reference.AWS CLI
-
Il seguente esempio di codice mostra come utilizzarelist-journal-s3-exports-for-ledger.
- AWS CLI
-
Per elencare i lavori di esportazione delle riviste per un libro mastro
L'
list-journal-s3-exports-for-ledgeresempio seguente elenca i lavori di esportazione delle scritture contabili per il libro contabile specificato.aws qldb list-journal-s3-exports-for-ledger \ --namemyExampleLedgerOutput:
{ "JournalS3Exports": [ { "LedgerName": "myExampleLedger", "ExclusiveEndTime": 1568847599.0, "ExportCreationTime": 1568847801.418, "S3ExportConfiguration": { "Bucket": "amzn-s3-demo-bucket", "Prefix": "ledgerexport1/", "EncryptionConfiguration": { "ObjectEncryptionType": "SSE_S3" } }, "ExportId": "ADR2ONPKN5LINYGb4dp7yZ", "RoleArn": "arn:aws:iam::123456789012:role/qldb-s3-export", "InclusiveStartTime": 1568764800.0, "Status": "IN_PROGRESS" } ] }Per ulteriori informazioni, consulta Exporting Your Journal in Amazon QLDB nella Amazon QLDB Developer Guide.
Il seguente esempio di codice mostra come usarelist-journal-s3-exports.
- AWS CLI
-
Per elencare i lavori di esportazione delle riviste
L'
list-journal-s3-exportsesempio seguente elenca i lavori di esportazione delle scritture contabili per tutti i libri contabili associati al AWS conto corrente e alla regione.aws qldb list-journal-s3-exportsOutput:
{ "JournalS3Exports": [ { "Status": "IN_PROGRESS", "LedgerName": "myExampleLedger", "S3ExportConfiguration": { "EncryptionConfiguration": { "ObjectEncryptionType": "SSE_S3" }, "Bucket": "amzn-s3-demo-bucket", "Prefix": "ledgerexport1/" }, "RoleArn": "arn:aws:iam::123456789012:role/my-s3-export-role", "ExportCreationTime": 1568847801.418, "ExportId": "ADR2ONPKN5LINYGb4dp7yZ", "InclusiveStartTime": 1568764800.0, "ExclusiveEndTime": 1568847599.0 }, { "Status": "COMPLETED", "LedgerName": "myExampleLedger2", "S3ExportConfiguration": { "EncryptionConfiguration": { "ObjectEncryptionType": "SSE_S3" }, "Bucket": "amzn-s3-demo-bucket", "Prefix": "ledgerexport1/" }, "RoleArn": "arn:aws:iam::123456789012:role/my-s3-export-role", "ExportCreationTime": 1568846847.638, "ExportId": "2pdvW8UQrjBAiYTMehEJDI", "InclusiveStartTime": 1568592000.0, "ExclusiveEndTime": 1568764800.0 } ] }Per ulteriori informazioni, consulta Exporting Your Journal in Amazon QLDB nella Amazon QLDB Developer Guide.
Il seguente esempio di codice mostra come utilizzare. list-ledgers
- AWS CLI
-
Per elencare i registri disponibili
L'
list-ledgersesempio seguente elenca tutti i libri contabili associati al AWS conto corrente e alla regione.aws qldb list-ledgersOutput:
{ "Ledgers": [ { "State": "ACTIVE", "CreationDateTime": 1568839243.951, "Name": "myExampleLedger" }, { "State": "ACTIVE", "CreationDateTime": 1568839543.557, "Name": "myExampleLedger2" } ] }Per ulteriori informazioni, consulta Basic Operations for Amazon QLDB Ledgers nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta Command Reference. ListLedgers
AWS CLI
-
Il seguente esempio di codice mostra come utilizzarelist-tags-for-resource.
- AWS CLI
-
Per elencare i tag allegati a un libro mastro
L'
list-tags-for-resourceesempio seguente elenca tutti i tag allegati al registro specificato.aws qldb list-tags-for-resource \ --resource-arnarn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedgerOutput:
{ "Tags": { "IsTest": "true", "Domain": "Test" } }Per ulteriori informazioni, consulta Tagging Amazon QLDB Resources nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta Command Reference. ListTagsForResource
AWS CLI
-
Il seguente esempio di codice mostra come utilizzarestream-journal-to-kinesis.
- AWS CLI
-
Esempio 1: per trasmettere i dati del journal a Kinesis Data Streams utilizzando file di input
L'
stream-journal-to-kinesisesempio seguente crea un flusso di dati del diario entro un intervallo di data e ora specificato da un registro con lo stesso nome.myExampleLedgerIl flusso invia i dati a un flusso di dati Amazon Kinesis specificato.aws qldb stream-journal-to-kinesis \ --ledger-namemyExampleLedger\ --inclusive-start-time2020-05-29T00:00:00Z\ --exclusive-end-time2020-05-29T23:59:59Z\ --role-arnarn:aws:iam::123456789012:role/my-kinesis-stream-role\ --kinesis-configurationfile://my-kinesis-config.json\ --stream-namemyExampleLedger-streamContenuto di
my-kinesis-config.json.{ "StreamArn": "arn:aws:kinesis:us-east-1:123456789012:stream/stream-for-qldb", "AggregationEnabled": true }Output:
{ "StreamId": "7ISCkqwe4y25YyHLzYUFAf" }Per ulteriori informazioni, consulta Streaming dei dati del journal da Amazon QLDB nella Amazon QLDB Developer Guide.
Esempio 2: Per trasmettere i dati del journal a Kinesis Data Streams utilizzando una sintassi abbreviata
L'
stream-journal-to-kinesisesempio seguente crea un flusso di dati del diario entro un intervallo di data e ora specificato da un registro con lo stesso nome.myExampleLedgerIl flusso invia i dati a un flusso di dati Amazon Kinesis specificato.aws qldb stream-journal-to-kinesis \ --ledger-namemyExampleLedger\ --inclusive-start-time2020-05-29T00:00:00Z\ --exclusive-end-time2020-05-29T23:59:59Z\ --role-arnarn:aws:iam::123456789012:role/my-kinesis-stream-role\ --stream-namemyExampleLedger-stream\ --kinesis-configurationStreamArn=arn:aws:kinesis:us-east-1:123456789012:stream/stream-for-qldb,AggregationEnabled=trueOutput:
{ "StreamId": "7ISCkqwe4y25YyHLzYUFAf" }Per ulteriori informazioni, consulta Streaming dei dati del journal da Amazon QLDB nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta StreamJournalToKinesis
Command Reference.AWS CLI
-
Il seguente esempio di codice mostra come utilizzaretag-resource.
- AWS CLI
-
Per etichettare un libro mastro
L'
tag-resourceesempio seguente aggiunge un set di tag a un registro specificato.aws qldb tag-resource \ --resource-arnarn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger\ --tagsIsTest=true,Domain=TestQuesto comando non produce alcun output.
Per ulteriori informazioni, consulta Tagging Amazon QLDB Resources nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta Command Reference. TagResource
AWS CLI
-
Il seguente esempio di codice mostra come utilizzareuntag-resource.
- AWS CLI
-
Per rimuovere i tag da una risorsa
L'
untag-resourceesempio seguente rimuove i tag con le chiavi dei tag specificati da un registro specificato.aws qldb untag-resource \ --resource-arnarn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger\ --tag-keysIsTestDomainQuesto comando non produce alcun output.
Per ulteriori informazioni, consulta Tagging Amazon QLDB Resources nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta Command Reference. UntagResource
AWS CLI
-
Il seguente esempio di codice mostra come utilizzareupdate-ledger-permissions-mode.
- AWS CLI
-
Esempio 1: per aggiornare la modalità di autorizzazione di un registro a STANDARD
L'
update-ledger-permissions-modeesempio seguente assegna la modalità diSTANDARDautorizzazione al registro specificato.aws qldb update-ledger-permissions-mode \ --namemyExampleLedger\ --permissions-modeSTANDARDOutput:
{ "Name": "myExampleLedger", "Arn": "arn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger", "PermissionsMode": "STANDARD" }Esempio 2: aggiornare la modalità di autorizzazione di un libro mastro a ALLOW_ALL
L'
update-ledger-permissions-modeesempio seguente assegna la modalità diALLOW_ALLautorizzazione al registro specificato.aws qldb update-ledger-permissions-mode \ --namemyExampleLedger\ --permissions-modeALLOW_ALLOutput:
{ "Name": "myExampleLedger", "Arn": "arn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger", "PermissionsMode": "ALLOW_ALL" }Per ulteriori informazioni, consulta Basic Operations for Amazon QLDB Ledgers nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta Command Reference. UpdateLedgerPermissionsMode
AWS CLI
-
Il seguente esempio di codice mostra come utilizzareupdate-ledger.
- AWS CLI
-
Esempio 1: per aggiornare la proprietà di protezione dall'eliminazione di un registro
L'
update-ledgeresempio seguente aggiorna il registro specificato per disabilitare la funzionalità di protezione dall'eliminazione.aws qldb update-ledger \ --namemyExampleLedger\ --no-deletion-protectionOutput:
{ "CreationDateTime": 1568839243.951, "Arn": "arn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger", "DeletionProtection": false, "Name": "myExampleLedger", "State": "ACTIVE" }Esempio 2: aggiornare la chiave AWS KMS di un libro mastro con una chiave gestita dal cliente
L'
update-ledgeresempio seguente aggiorna il registro specificato per utilizzare una chiave KMS gestita dal cliente per la crittografia a riposo.aws qldb update-ledger \ --namemyExampleLedger\ --kms-keyarn:aws:kms:us-west-2:123456789012:key/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111Output:
{ "CreationDateTime": 1568839243.951, "Arn": "arn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger", "DeletionProtection": false, "Name": "myExampleLedger", "State": "ACTIVE", "EncryptionDescription": { "KmsKeyArn": "arn:aws:kms:us-west-2:123456789012:key/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "EncryptionStatus": "UPDATING" } }Esempio 3: aggiornare la chiave AWS KMS di un libro mastro con una chiave proprietaria AWS
L'
update-ledgeresempio seguente aggiorna il registro specificato per utilizzare una chiave KMS AWS proprietaria per la crittografia a riposo.aws qldb update-ledger \ --namemyExampleLedger\ --kms-keyAWS_OWNED_KMS_KEYOutput:
{ "CreationDateTime": 1568839243.951, "Arn": "arn:aws:qldb:us-west-2:123456789012:ledger/myExampleLedger", "DeletionProtection": false, "Name": "myExampleLedger", "State": "ACTIVE", "EncryptionDescription": { "KmsKeyArn": "AWS_OWNED_KMS_KEY", "EncryptionStatus": "UPDATING" } }Per ulteriori informazioni, consulta Basic Operations for Amazon QLDB Ledgers nella Amazon QLDB Developer Guide.
-
Per i dettagli sull'API, consulta Command Reference. UpdateLedger
AWS CLI
-