Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Crea la tua prima serverless ledger-based app con QLDB e NodeJS

1,216 views

Published on

Molte aziende oggi, costruiscono applicazioni con funzionalità di tipo ledger ad esempio per verificare lo storico di accrediti o addebiti nelle transazioni bancarie o ancora per tenere traccia del flusso supply chain dei propri prodotti.
Alla base di queste soluzioni ci sono i database ledger che permettono di avere un log delle transazioni trasparente, immutabile e crittograficamente verificabile, ma sono strumenti complessi e onerosi da gestire.
Amazon QLDB elimina la necessità di costruire sistemi personalizzati e complessi fornendo un database ledger serverless completamente gestito.
In questa sessione scopriremo come realizzare un'applicazione serverless completa che utilizzi le funzionalità di QLDB.


  • Be the first to comment

Crea la tua prima serverless ledger-based app con QLDB e NodeJS

  1. 1. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Build your first Serverless ledger-based app with QLDB & NodeJS Dario Pizzuto – Solutions Architect
  2. 2. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Agenda • Modern app develompent • What’s a ledger? • Amazon QLDB • QLDB Hands on • Demo: Architecture overview & source code • Other resources
  3. 3. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential What do our customers want in a modern application? Scales to millions of users Global availability Responds in milliseconds Handles petabytes of data
  4. 4. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential What is the best way to build a modern application? Modular services Architectural patterns 1 As serverless as possible Operational model 2 Automated, Abstracted & Standardized Developer Agility 3 Programmatic Guardrails Management & Governance 4 Decoupled & Purpose built Data management 5
  5. 5. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Traditional three-tier application architecture Web servers Presentation layers Application servers Business logic Database servers Data layer
  6. 6. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Modern application architecture Presentation Business logic Data Queues/messages Events Events APIs
  7. 7. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Decoupling data along with business logic Massive data volume? One size does not fit all. What are the data needs of each modular service? Data warehousing? High speed rendering?
  8. 8. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Serverless reduces the operational load No infrastructure provisioning, no management Pay for value Automatic scaling Highly available
  9. 9. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential What is a ledger?
  10. 10. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Ledger technologies • built-in immutable journal that stores an accurate and sequenced entry of every data change • append-only • cryptographically verifiable Ledgers
  11. 11. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Need for a ledger with centralized trust Manufacturers Track distribution of a recalled product HR & payroll Track changes to an individual’s profile Healthcare Verify and track hospital equipment inventory DMV Track vehicle title history • Owned by a single, trusted authority • Addresses core need of an immutable and verifiable transactional log • Fast—doesn’t require consent from members to commit transactions Centralized
  12. 12. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Why consider purpose-built databases? Scale AvailabilityPerformance
  13. 13. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Purpose-built databases at AWS Aurora RDS DynamoDB DocumentDB TimestreamNeptuneElastiCache QLDB Managed Cassandra Relational Key value Document In-memory Graph Time series Ledger Wide column
  14. 14. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential How Amazon QLDB works
  15. 15. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Amazon QLDB: the journal is the database • QLDB’s journal has structural similarity to a database log • All writes go to the journal—the journal determines state • Journal handles concurrency, sequencing, cryptographic verifiability, and availability • Accessible history of all transactions, document versions, document metadata blockAdreess hash data metadata {strandId:"IiPT4AnNe WpE6YdoFiAK0U",seq uenceNo:136} {{s6ytAZivsX2ukJNSwB VvYZ5KjnFQRJHRDrU0 UKbYVRY=}} {Manufacturer:"Tesla",Mod el:"Model S",Year:2012,VIN:1234567 89,Owner:"Traci Russell"} {id:"Cxlp6cA36YOHylSC hJ7dzW",version:0,txTi me:2019-10- 28T12:19:50.098Z,txId: "JUJglL39zof3a0LKTXN RgX"} {strandId:"IiPT4AnNeW pE6YdoFiAK0U",seque nceNo:139} {{1fWeNgIm59pgnkdB ol83exdL+t/BAvVfICrX 8N9cYN4=}} {Manufacturer:"Tesla",Mode l:"Model S",Year:2012,VIN:1234567 89,Owner:"Ronnie Nash"} {id:"Cxlp6cA36YOHylSC hJ7dzW",version:1,txTi me:2019-10- 28T12:20:25.979Z,txId:" 1nmeGu0dy4nI3KHcsfC 4tr"} Manufacturer Model Year VIN Owner Tesla Model S 2012 123456789 Ronnie Nash history() #function to query document history User #standard user data, the default tx1 tx2 tx3 tx4 tx5 tx6 tx7 tx8 Journal blockAddress hash data metadata {strandId:"IiPT4A nNeWpE6YdoFiA K0U",sequenceN o:139} {{1fWeNgIm59pg nkdBol83exdL+t/ BAvVfICrX8N9cY N4=}} {Manufacturer:"Tesla",M odel:"Model S",Year:2012,VIN:12345 6789,Owner:"Ronnie Nash"} {id:"Cxlp6cA36YOHyl SChJ7dzW",version:1, txTime:2019-10- 28T12:20:25.979Z,txI d:"1nmeGu0dy4nI3K HcsfC4tr"} Committed #includes metadata select * from _ql_committed_cars select * from cars SELECT * FROM history(cars)
  16. 16. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential WritingReading Amazon QLDB—Journal First Database ID Manufacturer Model Year VIN Owner 1 Tesla Model S 2012 123456789 Robert Dennison History User/Current INSERT… UPDATE… DELETE… UPDATE… UPDATE… UPDATE… SEQUENCE NUMBER: 789 SEQUENCE NUMBER: 790 SEQUENCE NUMBER: 791 SEQUENCE NUMBER: 793 SEQUENCE NUMBER: 792 SEQUENCE NUMBER: -- Journal ledger Application data Amazon Quantum Ledger Database Writing ID Version Start Manufacturer Model Year VIN Owner 1 0 7/16/2012 Tesla Model S 2012 123456789 Traci Russell 1 1 8/03/2013 Tesla Model S 2012 123456789 Ronnie Nash 1 2 9/02/2016 Tesla Model S 2012 123456789 Robert Dennison
  17. 17. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Transactions (ACID) Isolation Level Potential Issues Serializable Snapshot Isolation Repeatable read Read committed Read uncommitted — Potential write skew Phantom reads Phantom reads/non-repeatable reads Phantom reads/non-repeatable reads/dirty reads HIGHESTTOLOWEST • Amazon QLDB supports the highest level of isolation • There is no other mode for QLDB • There is no risk that you’ll see phantom reads, write skew, dirty reads, or other issues
  18. 18. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Easy to use - Amazon Ion & PartiQL Amazon Ion /* Ion supports comments. */ vehicle = { ‘VIN’ : ‘KM8SRDHF6EU074761’ , ‘MfgDate’: `2017-03-01T` , ‘Type’: ‘Truck’ , ‘Mfgr’: ‘Ford’ , ‘Model’: ‘F150’ ‘Color”: ‘Black’ , ‘Specs’: { ‘EngSize’ : 3.3 ,(decimal) ‘CurbWeight’: 4878 , (int) ‘HP’: 327 ,(int) ‘BatterySize’ : NULL.int , } } PartiQL INSERT INTO cars { 'Manufacturer':'Tesla', 'Model':'Model S', 'Year': 2012, 'VIN': 123456789, 'Owner':'Traci Russell' } UPDATE cars SET owner = 'Ronnie Nash' WHERE VIN = 123456789 SELECT * FROM cars
  19. 19. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Serverless, scalable, highly available Region Availability Zone 1 Availability Zone 2 Journals Journals Availability Zone 3 Journals Multiple copies per AZ providing strong durability Multi-AZ for high availability
  20. 20. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential UPDATE… DELETE… UPDATE… UPDATE… UPDATE… Immutable INSERT… SEQUENCE NUMBER: 789 SEQUENCE NUMBER: 790 SEQUENCE NUMBER: 791 SEQUENCE NUMBER: 793 SEQUENCE NUMBER: 792 SEQUENCE NUMBER: -- Records cannot be altered • The journal is append only and sequenced • There is no API or other method to alter committed data • All operations, including deletes, are written to the journal
  21. 21. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Cryptographic verification Entries Block QLDB SQL Metadata journal Record hash Hash chaining using sha-256 Digest
  22. 22. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Amazon QLDB Journal-first The journal is the database ACID Transactions Fully serializable isolation Easy to use Familiar SQL operators Highly scalable Serverless, highly available Immutable Append-only, sequenced Cryptographically verifiable Hash-chaining provide data integrity
  23. 23. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential QLDB hands on
  24. 24. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential High Level Architecture
  25. 25. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential High level architecture AWS Cloud AWS AppSync Amazon Cognito AWS Amplify Web-App GraphQL Resolvers AWS Lambda Amazon QLDB Users
  26. 26. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Demo & code
  27. 27. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential AWS Training & Certification https://www.aws.training: Free on-demand courses to help you build new cloud skills Video: Amazon Quantum Ledger Database (QLDB) Service Introduction https://www.aws.training/Details/Video?id=40817 e-Learning: Amazon Quantum Ledger Database (QLDB) Service Primer https://www.aws.training/Details/eLearning?id=41760 For more info on AWS T&C visit: https://aws.amazon.com/it/training/
  28. 28. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential One more thing…
  29. 29. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential AWS Europe (Milan) Region On April, 28th AWS expanded its global footprint with the opening of the AWS Infrastructure Region in Italy. The new Region AWS Europe (Milano) brings advanced cloud technologies that enable opportunities for innovation, entrepreneurship, and digital transformation. For additional information about services and characteristics of an AWS Region, you can check the website: aws.amazon.com/local/italy/milan/
  30. 30. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential Thanks! dpizzuto@amazon.com

×