aws september webinar series - infrastructure deployment and monitoring with aws lambda and amazon...

29
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Presenter Vyom Nagrani, Sr. Product Manager, AWS Lambda Q&A Moderators Ajay Nair, Sr. Product Manager, AWS Lambda Arjun Cholkar, Principal Product Manager, Amazon SNS September 15 th , 2015 Best Practices: Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Upload: amazon-web-services

Post on 14-Apr-2017

2.748 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

PresenterVyom Nagrani, Sr. Product Manager, AWS Lambda

Q&A ModeratorsAjay Nair, Sr. Product Manager, AWS LambdaArjun Cholkar, Principal Product Manager, Amazon SNS

September 15th, 2015

Best Practices: Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Page 2: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Amazon Simple Notification Service (SNS): publish messages to multiple subscribers

• Follows the “publish-subscribe” (pub-sub) messaging paradigm

• Group multiple recipients using topics

• Send to mobile device users, email recipients or distributed services

• No upfront costs and pay as you go pricing

Publisher

Subscriber 1

Subscriber 2

Subscriber 3

Subscriber 4

Amazon SNS

Page 3: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Benefits of Amazon SNS for push notifications

“Fast, Flexible, Global Messaging to Any Device or Endpoint”

Global and Fast at Massive Scale

Send billions of messages per day with minimal latencies

across the world Use via Java, Python, PHP, Node.js, or .NET

Support for Multiple Platforms or Frameworks

Send Messages to Any Device or Endpoint

Send Notifications via Mobile Push, SQS, HTTP, Email, SMS, or

Lambda

Page 4: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

AWS Lambda: A compute service that runs your code in response to events

Lambda functions: Stateless, trigger-based code execution

Triggered by events:• Direct Sync and Async invocations • Put to an Amazon S3 bucket• SNS subscription• And many more …

Makes it easy to• Build back-end services that perform at scale • Perform data-driven auditing, analysis, and notification

Page 5: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

High performance at any scale; Cost-effective and efficient

No Infrastructure to manage

Pay only for what you use: Lambda automatically matches capacity to

your request rate. Purchase compute in 100ms increments.

Bring Your Own Code

“Productivity focused compute platform to build powerful, dynamic, modular applications in the cloud”

Run code in a choice of standard languages. Use threads, processes,

files, and shell scripts normally.

Focus on business logic, not infrastructure. You upload code; AWS

Lambda handles everything else.

Benefits of AWS Lambda for building a server-less data processing engine

1 2 3

Page 6: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Subscribe your Lambda functions to SNS topics

Customer Systems

End-User Devices(via AWS Mobile

SDK)

“Direct Publish”

publish (msg, endpointARN)

Topic “A”

“Topic Publish”

publish(msg,topicArn)

APN

SG

CM

AD

MW

NS

Mobile Push Gateways

Amazon SQS Queues

HTTP Destinations

SMS (US Mobile Numbers Only)

Email

AWS Lambda Functions

Page 7: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Walkthrough of using an Amazon SNS message to invoke AWS Lambda

Amazon SNS

AWS Lambda Amazon CloudWatch Logs

Publish message to

topic

Page 8: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 9: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 10: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 11: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 12: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 13: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 14: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 15: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 16: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 17: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 18: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 19: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS
Page 20: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Attaching Lambda functions to Amazon SNS topic subscriptions

• Multiple subscriptions: Subscribe multiple Lambda functions to same SNS topic

• For every subscribed function, each message to the SNS topic will invoke Lambda once

• Retries: For Amazon SNS, AWS Lambda retries each function at least 3 times

• Permission model: SNS pushes events to Lambda, so grant SNS invocation

permission through a resource policy, and add the execution role to Lambda

• Automatic Scaling: Lambda scales automatically with SNS publish rate

• Safety throttle of 100 concurrent Lambda functions, can be increased by AWS Support Center

Page 21: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Monitoring and Debugging Lambda functions

• Console Dashboard• Lists all Lambda functions• Easy editing of resources, event sources and other settings• At-a-glance metrics

• Metrics in CloudWatch• Requests• Errors• Latency• Throttles

• Logging in CloudWatch Logs

Page 22: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Using SNS+Lambda for automated responses to alerts (Infrastructure Monitoring and Deployment)

AWS Lambda

Amazon SNS

Amazon CloudWatch Alarm

ec2runInstance

ecsstartTask

beanstalkupdateApp

kinesissplitShard

Any API call

Page 23: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Use cases of SNS+Lambda for Infrastructure Monitoring and AutomationInput from CloudWatch Alarms• EC2 metrics: CPU, Disk, Network, Health• EBS metrics: Read/Write Bytes/Ops• ELB metrics: HTTPCode• S3 metrics: NumberObjects, BucketSize• DynamoDB metrics: Read/Write capacity• Custom metrics/alarms

Output functionality• Launch instance/tasks/apps• Provision tables/shards/storage• External endpoints

https://aws.amazon.com/blogs/compute/scaling-amazon-ecs-services-automatically-using-amazon-cloudwatch-and-aws-lambda/

Page 24: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Using Lambda to forward SNS messages to external endpoints

http://danilop.net/aws/2015/07/26/sns2ifttt/ | https://github.com/danilop/SNS2IFTTT

AWS Lambda

Amazon SNS

IFTTT via the Maker channel

Amazon CloudWatch Alarm

Amazon AutoScaling

Page 25: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Using SNS fan out S3 event notifications to multiple Lambda functions

https://aws.amazon.com/blogs/compute/fanout-s3-event-notifications-to-multiple-endpoints/

Amazon S3 Amazon SNS

AWS Lambda Function 1

AWS Lambda Function 2

Page 26: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Using SNS+Lambda to manage and deploy Lambda functions

https://aws.amazon.com/blogs/compute/dynamic-github-actions-with-aws-lambda/

AWS Lambda

Amazon SNS

GitHub Repo

lambda createFn ()

Page 27: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Three Next Steps

1. Create and test your first Amazon SNS topic. When publishers have information or updates to notify their subscribers about, they can publish a message to the topic – which immediately triggers Amazon SNS to deliver the message to all applicable subscribers.

2. Create and test your first Lambda function. With AWS Lambda, there are no new languages, tools, or frameworks to learn. You can use any third party library, even native ones.

3. Subscribe your Lambda function to your SNS topic … A message delivery from Amazon SNS to an AWS Lambda function creates an instance of the AWS Lambda function and invokes it with your message as an input.

Page 28: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

Thank you!

Visit http://aws.amazon.com/sns, the AWS Mobile Development blog, and the SNS forum to learn more and get started using Amazon SNS

Visit http://aws.amazon.com/lambda, the AWS Compute blog, and the Lambda forum to learn more and get started using Lambda.

Page 29: AWS September Webinar Series - Infrastructure Deployment and Monitoring with AWS Lambda and Amazon SNS

AWS re:Invent 2015 – October 6-9AWS re:Invent is the largest annual gathering of the global cloud community. Whether you are an existing customer or new to the cloud, AWS re:Invent will provide you with the knowledge and skills to refine your cloud strategy, improve developer productivity, increase application performance and security, and reduce infrastructure costs.

Though AWS re:Invent tickets are sold out, you can still register to view the Live Stream Broadcasts of the keynote addresses and select technical sessions on October 7 and October 8. Register now.

Details:Wednesday, October 79:00am - 10:30am PT: Andrew Jassy, Sr. Vice President, AWS11:00am - 5:15pm PT: 5 of the most popular breakout sessions (to be announced)

Thursday, October 89:00am - 10:30am PT: Dr. Werner Vogels, CTO, Amazon11:00am - 6:15pm PT: 6 of the most popular breakout sessions (to be announced)

Register now for the Live Stream Broadcast by submitting your email where prompted on the AWS re:Invent home page.

Stay Connected: Follow event activities on Twitter @awsreinvent (#reinvent), or like us on Facebook.