January 2017 - Deep dive on AWS Lambda and DevOps

20

Click here to load reader

Transcript of January 2017 - Deep dive on AWS Lambda and DevOps

Page 1: January 2017 - Deep dive on AWS Lambda and DevOps

AWS Users’ Group UpdatesDavid “Mac” McDanielSr. Solution & Cloud [email protected] / [email protected]: https://www.linkedin.com/in/davidbmcdanielTwitter: @CloudKegGuy, @ServerlessJavaTwitter list: https://twitter.com/CloudKegGuy/lists/aws/members

Page 2: January 2017 - Deep dive on AWS Lambda and DevOps

New AWS Users’ Group Items

Slack Channel: https://DenverAWSUsersGroup.slack.com

You will need an invitation to join, please email me: [email protected].

Survey will be going out before next meeting!

Channels include:

● #general for any questions● #i-a-a-s for Infrastructure (Servers etc) as a Service questions/discussions● #p-a-a-s for Platform as a Service questions/discussions● More?

Page 3: January 2017 - Deep dive on AWS Lambda and DevOps

Next Month’s TOPIC:

????

We need speakers!

Page 4: January 2017 - Deep dive on AWS Lambda and DevOps

How big is Amazon anyway?

Page 5: January 2017 - Deep dive on AWS Lambda and DevOps

Progression of “As A Service” models

Software as a Service: Multi-tenant, provider-hosted software - Salesforce.com

Infrastructure as a Service: Multi-tenant, provider-hosted operating systems

Platform as a Service: A specific piece of functionality as a service - queuing, emailing, storing, etc

Function as a Service: Deploying your own code - as a service.Benefits: No servers to manage, Microservice architecture, smaller deployable units, pay by the second billing, automatic logging, etc.

Page 6: January 2017 - Deep dive on AWS Lambda and DevOps

Lambdas: Amazon’s FaaS● Program in Java, Node.js, Python, C# - more coming● Mix-and-match languages in different Lambdas● Easily connect to DynamoDB, S3, SQS, SNS etc● Easy integration with API Gateway● Lambda can serve as event target for SQS, SNS, S3 Events, Dynamo, Kinesis,

Aurora● Can run within IoT device and on AWS’s Edge network● Excellent for RESTful service implementation - single resource/single method,

single resource/multiple method or multiple resource/multiple method

Page 7: January 2017 - Deep dive on AWS Lambda and DevOps

Lambda

Page 8: January 2017 - Deep dive on AWS Lambda and DevOps

Lambdas

Page 9: January 2017 - Deep dive on AWS Lambda and DevOps

Step Functions - Coordinates Lambdas

Page 10: January 2017 - Deep dive on AWS Lambda and DevOps

Ways to call Lambdas

Page 11: January 2017 - Deep dive on AWS Lambda and DevOps

Architecture in Lambdas

Changes focus of architecture and centers it more around the domain rather than on infrastructure of your system.

Almost forces moving away from monolithic architecture into more component or functional architecture.

Creates better division of responsibilities/separation of concerns.

Allows for better re-use and service combining.

Automatic and virtually unlimited scaling.

Page 12: January 2017 - Deep dive on AWS Lambda and DevOps

Lambda ArchitectureIoT

StepFunction

Page 13: January 2017 - Deep dive on AWS Lambda and DevOps

Different Architectural Styles

I’ve created what I call “Domain Service Architecture”.

Major Architecture Styles:

1. Monolithic (ex: 2-Tier Client/Server, Mainframe)2. Services Oriented Architecture (too generic):

a. Micro Service - every operation has different implementation/functioni. Some people state that every service should have own persistence

b. Macro Service - somewhere in between Monolithic and Microc. Domain Service - encompasses everything about a small domain of the system.d. Functional Service - every function has own service; similar to Micro

Page 14: January 2017 - Deep dive on AWS Lambda and DevOps

Architecture Advantages of “Domain” Services● In RESTful terms, Domain = Resource; In DB terms, Domain = Table

(+Supporting tables)● Encompasses all operations on the Domain object - therefore doesn’t force

multiple services/functions to handle one domain object! This is big!● Allows composition of multiple Domain Services into Business Service● UI’s use both Business Services and Domain Services● Smaller Testing units● Smaller & Faster deployment units● Lower risk because smaller deployment unit =

less change per deployment● Decouples different domains from each other.

Page 15: January 2017 - Deep dive on AWS Lambda and DevOps

id: ...Name: varcharAttr1: …Attr2: ….ShipAddrId: ...Etc: ...

Customer

id: ...CustId: ...ContactId: …AddressId: [...]Etc: ...

CustomerContactLink

id: ...FName: ...LName: ...Phone: ...Etc: ...

Contact

id: ...OriginId: ...DestId: ...OrderDate: dateEtc: ...

Shipments

Contact Domain Shipments Domain

Customer Domainid: ...Name: varcharAddr1: …Addr2: ….Etc: ...

Address

Domain Service Architecture example

Page 16: January 2017 - Deep dive on AWS Lambda and DevOps

DevOps Differences

● Smaller, Faster deployments● Ability to mix-and-match programming languages● Incremental deployments now possible● No long dev-test-qa-deploy cycle● Smaller, more responsive teams● Less overhead in coordination of deployments/development

Page 17: January 2017 - Deep dive on AWS Lambda and DevOps

Maven Project: MASTER

Maven Project: Shipments

Maven Project: Customers

Maven Project: Contacts

DB Object: Contact

DB Object: CCLink

DB Object: Address

DB Object: Customer

DB Object: ShipmentWeak Ref

(ID only)

Weak Ref(ID only)

Page 18: January 2017 - Deep dive on AWS Lambda and DevOps

@DELETE@Path("/{id}")public Response deleteContact(@PathParam("id") String id){

LOG.debug("Entering contacts::DELETE /" + id);...

}@POST@Consumes({MediaType.APPLICATION_JSON})@Produces({MediaType.APPLICATION_JSON})public Response createContact(ContactObject co){

LOG.debug("Entering contacts::POST");…

}@PUT@Path("/{id}")@Produces({MediaType.APPLICATION_JSON})@Consumes({MediaType.APPLICATION_JSON})public Response updateContact(@PathParam("id") String id, ContactObject co){

LOG.debug("Entering contacts::PUT /" + id);…

}@GET@Produces({MediaType.APPLICATION_JSON})public Response getByCustId(@QueryParam("cid") String cid){

LOG.info("Entering contacts::GET ?cid=" + cid);…

}

Page 19: January 2017 - Deep dive on AWS Lambda and DevOps

Important Libraries

1. JAX-RS/Jersey/Jackson: For @GET/@Path/etc Annotations and automatic conversion of Objects to JSON and JSON to Objects.

2. JRestless: Interface between Lambda and Jersey.3. Hibernate: Persistence ORM.4. Swagger: Automatically creates API definition files.5. ServerlessJava: Builds, deploys, configures, versions Java Lambdas.

Page 20: January 2017 - Deep dive on AWS Lambda and DevOps

Questions?