Kotlin is a language from the tool gurus at JetBrains. In 2016, after about six years of development, Kotlin reached version 1.0. In 2017 it won the hearts of developers and became an officially supported language for Android.
Kotlin, like Java, is for more than creating Android applications. It can replace or enhance Java most places it is used today including on AWS. AWS Lambda functions sometimes called Serverless Computing, is a service which lets us developers build web services without worrying about configuring servers.
In this session, we will create a lambda service on AWS using Kotlin. Along the way, we will learn what a makes Kotlin an excellent replacement for Java and how simple it is to construct an AWS Lambda function.
2. Troy Miles
• Troy Miles aka the RocknCoder
• Over 38 years of programming
experience
• Speaker and author
• bit.ly/rc-jquerybook
• rockncoder@gmail.com
• @therockncoder
• lynda.com Author!
3. Kotlin for Java Developers
Join me at KotlinConf 2+3 Nov 2017 in San Francisco
4. Agenda
• Kotlin
• Microservice
• RESTful API
• HTTP Methods
• Amazon Lambda
• Amazon API Gateway
• Spring MVC
• Debugging
• Next Steps
5. A Microservice…
• Is a service with one narrowly defined focused
• Is individually deployable
• Consists of one or more process
• Owns its data store
• Is replaceable
6. Amazon Web Services
• We’ve decided to move to AWS
• Two phases:
• Now - Lift and Shift - get it running on EC2
• Later - Microservices & Client-side - bust it apart
8. History
• Announced in 2011 by JetBrains
• Open sourced in 2012 under Apache 2
• Version 1.0 released February 2016
• May 2017 Google Kotlin an Android language
9. Features
• Makes apps for Android, JVM, Browser, and Native
• 100% interoperable with Java
• Clean, succinct syntax
• Null-pointer exception safety
• Lambda functions and other function features
11. Treat AWS Like Money
• If your account is compromised, it can be very bad
• Criminals can easily charge thousands of $$$ of
AWS services to you in minutes
• Never use your root account
• Always use 2FA
12. AWS Lambda
• Runs code without provisioning servers
• Pay only for compute time used
• Scales automatically
• Uses CloudWatch for monitoring
• Execution environment is Amazon Linux
13. Lambda Pricing: Request
• You are charged for the number of requests +
• You are charged for the duration of the request
• The first 1 million requests are free
• $0.20 per 1 million requests after the first million
14. Lambda Pricing: Duration
• Duration is per second round up to the nearest
100ms
• You are charged $0.00001667 for every GB-
second used
• The first 400,000 GB/seconds is free
• Faster and smaller lambdas are cheaper
18. AWS API Gateway
• Fully managed service for programmatically
creating APIs
• Tightly integrates with Lambda
• Combines with CloudFront for edge caching
• Think of it as a flexible front door for your API
20. RESTful API
• Makes use of HTTP methodologies defined by RFC
2616 protocol
• Preferred over SOAP since it uses less bandwidth
• Breaks down a transaction into a series of HTTP
methods
• Stateless by design