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.

Introduction to Version 3 of the AWS SDK for JavaScript (TypeScript) (DEV379-R2) - AWS re:Invent 2018

136 views

Published on

The AWS SDK for JavaScript simplifies programmatically interacting with over a hundred AWS services. In this talk, we will introduce the next major version of the AWS SDK for JavaScript. You will learn about new features such as the promise-based middleware that makes it easy to customize your calls to AWS services, and more accurate TypeScript definitions for operation inputs and outputs. We’ll use a sample application to demonstrate these features, and show how to optimize your builds to get much smaller JavaScript bundle sizes than are possible today.

  • Be the first to comment

  • Be the first to like this

Introduction to Version 3 of the AWS SDK for JavaScript (TypeScript) (DEV379-R2) - AWS re:Invent 2018

  1. 1. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Introduction to Version 3 of the AWS SDK for JavaScript (TypeScript) Christopher Radek Software Development Engineer Amazon Web Services/SDKs D E V 3 7 9 - R Trevor Rowe Software Development Manager Amazon Web Services/SDKs
  2. 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Key features of the v3 AWS SDK for JavaScript TypeScript Modularized Middleware Promise-based API Client-specific configuration Standalone signers Consistent credential loading
  3. 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Improved dev experience with TypeScript JavaScript with types Code completion in editors Ships as JavaScript Types optional function sayHello(name: string): void { console.log(`Hello, ${name}!`); } sayHello('re:invent');
  4. 4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  5. 5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Monolithic v2 SDK clients xml query utilities aws-sdk
  6. 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Modularized v3 SDK S3 DynamoDBLambdaEC2 Query JSONSigners RESTXML
  7. 7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Size benefits of modularization 1720 222 101 55 246 65 20 16 0 200 400 600 800 1000 1200 1400 1600 1800 2000 v2 (full) v2 (single) v3 (client) v3 (command) SDK size in KB bundled gzipped
  8. 8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  9. 9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Service packages are code-generated Package Generator Models Easier to debug Better stack traces Meaningful diffs Easier to mock
  10. 10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Promise-based async function invoke() { try { const data = await lambda.invoke({ FunctionName: 'foo’ }); console.log(data.Payload); } catch (err) { console.error(err); } }
  11. 11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Per-client configuration const lambda = new Lambda({ region: 'us-west-2’, credentials: {/* creds */}, maxRetries: 3 });
  12. 12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Shares configuration with AWS CLI # ~/.aws/config [default] aws_access_key_id=foo aws_secret_access_key=bar [profile dev] aws_access_key_id=foo2 aws_secret_access_key=bar2
  13. 13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Standalone Signature Version 4 Signers const {SignatureV4} = require('@aws-sdk/signature-v4-node’); async function sign() { const signer = new SignatureV4({/* configuration */}); const signedRequest = await signer.sign({/* apiGatewayRequest */}); return signedRequest; }
  14. 14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  15. 15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Available on GitHub aws/aws-sdk-js-v3
  16. 16. Thank you! © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  17. 17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

×