SlideShare a Scribd company logo
Auto Retweet Using AWS
Lambda
Srushith R
@SrushithR
CodeOps Technologies
Krishna Kishore (KK)
How will the application
handle server hardware failure?
How can I control
Serversaccess from my servers?
When should I decideto
scale out my servers?
When should I decideto
scale up myservers?
What size servers are
right for my budget?
How much remaining
capacity do my
servers have?
(AAHHHHHHHHH!!)
How will I keep
my server OS
patched?
How many
servers should I
budget for?
Content source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-getting-started-with-
serverless-architectures-cmp211
2
• VMs
• Machine as the unit of scale
• Abstracts the hardware
• Containers
• Application as the unit of scale
• Abstracts the OS
• Serverless
• Functions as the unit of scale
• Abstracts the language runtime
AWS Lambda
Amazon ECS
Amazon EC2
What is Serverless
computing?
Content source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-
getting-started-with-serverless-architectures-cmp211
3
AWS Lambda 4
Topics covered: AWS
Lambda
 Overview
 Key features
 Working with Lambda
 Developing, deploying and testing on Lambda
 Demo
 Logging
 Benefits
 Use cases
5
Lambda: Overview
 AWS Lambda is a serverless compute service that
runs your code in response to events and
automatically manages the underlying compute
resources for you
 It executes your code only when needed and scales
automatically, from a few requests per day to
thousands per second
6
Content source: https://aws.amazon.com/documentation/
Lambda: Overview
 You pay only for the compute time you consume -
there is no charge when your code is not running
 With AWS Lambda, you can run code for virtually any
type of application or backend service - all with zero
administration
7
Content source: https://aws.amazon.com/documentation/
Lambda: Key features 8
Extend Other
AWS Services
with Custom
Logic
Build Custom
Back-end
Services
Completely
Automated
Administration
Built-in Fault
Tolerance
Automatic
Scaling
Run Code at
Edge Locations
Integrated
Security Model
Classical Architecture 9
Content source: https://blog.couchbase.com/serverless-faas-aws-lambda-java/
Serverless Architecture
Content source: https://blog.couchbase.com/serverless-faas-aws-lambda-java/
10
Lambda integrated with
other services
11
Content source: https://www.slideshare.net/AmazonWebServices/aws-lambda-and-the-serverless-cloud
Triggers for Lambda 12
Content source: https://www.slideshare.net/AmazonWebServices/aws-lambda-and-the-serverless-cloud
Working with Lambda 13
Content source: https://aws.amazon.com/lambda/
Bring your own code
• Node.js, Java, Python
• Bring your own libraries
(even native ones)
Simple resource model
• Select power rating from
128 MB to 1.5 GB
• CPU and network
allocated proportionately
• Reports actual usage
Flexible authorization
• Securely grant access to
resources, including
VPCs
• Fine-grained control
over who can call your
functions
Flexible use
• Call or send events
• Integrated with other
AWS services
• Build whole serverless
ecosystems
Using Lambda 14
Lambda execution
environment
15
Linux kernel version –
4.4.51-
40.60.amzn1.x86_64
Public Amazon Linux AMI
version (AMI name: amzn-
ami-hvm-
2016.03.3.x86_64-gp2)
Image source: https://en.wikipedia.org/wiki/Linux_kernel
Lambda runtime
Lambda supports the following runtime versions:
16
Node.js
• v4.3.2
• v6.10.2
Java
• Java 8
Python
• Python
3.6
• Python
2.7
.NET Core
• .NET
Core
1.0.1 (C#)
Note: If you are using any native binaries in your code, make sure they are compiled in this
environment. Also note that only 64-bit binaries are supported on AWS Lambda
Three ways to create a
Lambda function
17
Content source: https://aws.amazon.com/documentation/
Lambda
AWS Lambda
console (web
User
Interface)
AWS SDK
(Software
Development
Kit)
AWS CLI
(Command
Line Interface)
Deploying you code 18
There are three ways to deploy your code :
Logging in AWS Lambda
19
Your Lambda function can contain logging statements. AWS Lambda
writes these logs to CloudWatch. Logging can be done in two ways:
Content source: https://aws.amazon.com/documentation/
Logging
Print statements
Language specific
logging libraries
Amazon CloudWatch logs
 You can use Amazon CloudWatch Logs to monitor,
store, and access your log files from AWS
Lambda. You can then retrieve the associated log
data from CloudWatch Logs
 Archive Log Data—You can use CloudWatch Logs to
store your log data in highly durable storage
20
Content source: https://aws.amazon.com/documentation/
Accessing CloudWatch logs
for lambda
21
Content source: https://www.slideshare.net/AmazonWebServices/aws-lambda-and-the-serverless-cloud
Lambda limits 22
Content source: http://docs.aws.amazon.com/lambda/latest/dg/limits.html
1
No Servers to
Manage
2
Continuous
Scaling
3
Subsecond
Metering
Benefits 23
Lambda use cases 24
Content source: https://www.slideshare.net/AmazonWebServices/aws-lambda-and-the-serverless-cloud
25
DEMO!
Python code sample 26
The code is available in the github repo:
https://github.com/CodeOpsTechnologies/Real_time_retweets
Prerequisites for the zip file:
1. Python-twitter module:
The module must be installed into a separate folder. Use
the modified pip command:
pip install --target <target folder path> python-twitter
Note: The python code uses boto3 module, but installing it is not
required as it is available as a default module in AWS Lambda
Steps to deploy code to
Lambda
1. Create a zip file with the python code and dependency
modules (python-twitter).
2. Create a Lambda function
 Upload the zip file
 Define environment variables and encrypt them
3. Create an event to schedule the lambda every one hour
27
Create Lambda 28
Encrypt Environment Variables 29
Enable encryption to
encrypt the environment
variables
choose an
encryption key
Lambda function handler 30
handler is of the format:
<python code file
name>.lambda_handler
IAM role with logging
permissions
Input to the Lambda 31
twitter user name you
want to retweet from
(without ‘@’)
Schedule an event 32
choose ‘rules’ under
‘events’ in CouldWatch
select ‘schedule’
33
schedule a fixed rate or as
a cron expression
Schedule an event
Select target Lambda 34
select the target
Lambda function
Pass the input event 35
select ‘constant’ and add
the input event in JSON
format
Create! 36
Schedule rule 37
Output 38
Serverless Summit
Join us at India’s first
conference on serverless
technologies!
39
Scheduled Retweets Using AWS Lambda

More Related Content

Similar to Scheduled Retweets Using AWS Lambda (15)

PDF
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
MongoDB
 
PPTX
Serverless Architecture
Elana Krasner
 
PDF
Serverless Computing
Rushi Namani
 
PPTX
Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...
Srini Karlekar
 
PDF
AWS re:Invent 2020 Serverless Recap
Daniel Zivkovic
 
PDF
Getting Started with AWS Lambda & Serverless Cloud
Ian Massingham
 
PPTX
muCon 2017 - 12 Factor Serverless Applications
Chris Munns
 
PDF
AWS Community Day Bangkok 2019 - Build a Serverless Web Application in 30 mins
AWS User Group - Thailand
 
PDF
Introduction to AWS
Angel Borroy López
 
PDF
Comprehensive Guide: Web Scraping with AWS Lambda
X-Byte Enterprise Crawling
 
PDF
Symfony aws
Alessandro Minoccheri
 
PDF
AWSomeDay Zurich 2018 - How to go serverless
Roman Plessl
 
PDF
Cloudformation & VPC, EC2, RDS
Can Abacıgil
 
PDF
12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...
Cloud Native Day Tel Aviv
 
PDF
Building serverless apps with Node.js
Julien SIMON
 
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
MongoDB
 
Serverless Architecture
Elana Krasner
 
Serverless Computing
Rushi Namani
 
Building Cross-Cloud Platform Cognitive Microservices Using Serverless Archit...
Srini Karlekar
 
AWS re:Invent 2020 Serverless Recap
Daniel Zivkovic
 
Getting Started with AWS Lambda & Serverless Cloud
Ian Massingham
 
muCon 2017 - 12 Factor Serverless Applications
Chris Munns
 
AWS Community Day Bangkok 2019 - Build a Serverless Web Application in 30 mins
AWS User Group - Thailand
 
Introduction to AWS
Angel Borroy López
 
Comprehensive Guide: Web Scraping with AWS Lambda
X-Byte Enterprise Crawling
 
AWSomeDay Zurich 2018 - How to go serverless
Roman Plessl
 
Cloudformation & VPC, EC2, RDS
Can Abacıgil
 
12 Factor Serverless Applications - Mike Morain, AWS - Cloud Native Day Tel A...
Cloud Native Day Tel Aviv
 
Building serverless apps with Node.js
Julien SIMON
 

More from Srushith Repakula (17)

PDF
Building an AI-Powered Photo Gallery with Serverless and Event-Driven Magic!
Srushith Repakula
 
PDF
How we scaled to 80K users by doing nothing!.pdf
Srushith Repakula
 
PDF
Lessons Learned from Building a Serverless Notifications System.pdf
Srushith Repakula
 
PDF
Serverless - Your Gateway to the Cloud!
Srushith Repakula
 
PDF
Experiences in Architecting & Implementing Platforms using Serverless.pdf
Srushith Repakula
 
PDF
Serverless: Beyond Lambda Functions (V2)
Srushith Repakula
 
PDF
Getting Started with Amazon EventBridge
Srushith Repakula
 
PDF
CICD in the World of Serverless
Srushith Repakula
 
PDF
Real Time Serverless Polling App
Srushith Repakula
 
PPTX
Serverless Workshop - Tomato Restaurant Rating App
Srushith Repakula
 
PPTX
Become Thanos of the LambdaLand: Wield all the Infinity Stones
Srushith Repakula
 
PPTX
Serverless by Examples and Case Studies
Srushith Repakula
 
PPTX
Lambda land: Running a serverless ticketing platform for less than $2 a month
Srushith Repakula
 
PDF
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way
Srushith Repakula
 
PPTX
Chatbots with Serverless
Srushith Repakula
 
PPTX
Keep Calm and Code Python - Build Cool Stuff Uing Python
Srushith Repakula
 
PPTX
Serverless: Why is it hot and What is it not?
Srushith Repakula
 
Building an AI-Powered Photo Gallery with Serverless and Event-Driven Magic!
Srushith Repakula
 
How we scaled to 80K users by doing nothing!.pdf
Srushith Repakula
 
Lessons Learned from Building a Serverless Notifications System.pdf
Srushith Repakula
 
Serverless - Your Gateway to the Cloud!
Srushith Repakula
 
Experiences in Architecting & Implementing Platforms using Serverless.pdf
Srushith Repakula
 
Serverless: Beyond Lambda Functions (V2)
Srushith Repakula
 
Getting Started with Amazon EventBridge
Srushith Repakula
 
CICD in the World of Serverless
Srushith Repakula
 
Real Time Serverless Polling App
Srushith Repakula
 
Serverless Workshop - Tomato Restaurant Rating App
Srushith Repakula
 
Become Thanos of the LambdaLand: Wield all the Infinity Stones
Srushith Repakula
 
Serverless by Examples and Case Studies
Srushith Repakula
 
Lambda land: Running a serverless ticketing platform for less than $2 a month
Srushith Repakula
 
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way
Srushith Repakula
 
Chatbots with Serverless
Srushith Repakula
 
Keep Calm and Code Python - Build Cool Stuff Uing Python
Srushith Repakula
 
Serverless: Why is it hot and What is it not?
Srushith Repakula
 
Ad

Recently uploaded (20)

PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PDF
Simplify React app login with asgardeo-sdk
vaibhav289687
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PDF
IObit Driver Booster Pro 12.4.0.585 Crack Free Download
henryc1122g
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
PPTX
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
NSF Converter Simplified: From Complexity to Clarity
Johnsena Crook
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Simplify React app login with asgardeo-sdk
vaibhav289687
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
IObit Driver Booster Pro 12.4.0.585 Crack Free Download
henryc1122g
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
NSF Converter Simplified: From Complexity to Clarity
Johnsena Crook
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Ad

Scheduled Retweets Using AWS Lambda

  • 1. Auto Retweet Using AWS Lambda Srushith R @SrushithR CodeOps Technologies Krishna Kishore (KK)
  • 2. How will the application handle server hardware failure? How can I control Serversaccess from my servers? When should I decideto scale out my servers? When should I decideto scale up myservers? What size servers are right for my budget? How much remaining capacity do my servers have? (AAHHHHHHHHH!!) How will I keep my server OS patched? How many servers should I budget for? Content source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-getting-started-with- serverless-architectures-cmp211 2
  • 3. • VMs • Machine as the unit of scale • Abstracts the hardware • Containers • Application as the unit of scale • Abstracts the OS • Serverless • Functions as the unit of scale • Abstracts the language runtime AWS Lambda Amazon ECS Amazon EC2 What is Serverless computing? Content source: https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016- getting-started-with-serverless-architectures-cmp211 3
  • 5. Topics covered: AWS Lambda  Overview  Key features  Working with Lambda  Developing, deploying and testing on Lambda  Demo  Logging  Benefits  Use cases 5
  • 6. Lambda: Overview  AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you  It executes your code only when needed and scales automatically, from a few requests per day to thousands per second 6 Content source: https://aws.amazon.com/documentation/
  • 7. Lambda: Overview  You pay only for the compute time you consume - there is no charge when your code is not running  With AWS Lambda, you can run code for virtually any type of application or backend service - all with zero administration 7 Content source: https://aws.amazon.com/documentation/
  • 8. Lambda: Key features 8 Extend Other AWS Services with Custom Logic Build Custom Back-end Services Completely Automated Administration Built-in Fault Tolerance Automatic Scaling Run Code at Edge Locations Integrated Security Model
  • 9. Classical Architecture 9 Content source: https://blog.couchbase.com/serverless-faas-aws-lambda-java/
  • 10. Serverless Architecture Content source: https://blog.couchbase.com/serverless-faas-aws-lambda-java/ 10
  • 11. Lambda integrated with other services 11 Content source: https://www.slideshare.net/AmazonWebServices/aws-lambda-and-the-serverless-cloud
  • 12. Triggers for Lambda 12 Content source: https://www.slideshare.net/AmazonWebServices/aws-lambda-and-the-serverless-cloud
  • 13. Working with Lambda 13 Content source: https://aws.amazon.com/lambda/
  • 14. Bring your own code • Node.js, Java, Python • Bring your own libraries (even native ones) Simple resource model • Select power rating from 128 MB to 1.5 GB • CPU and network allocated proportionately • Reports actual usage Flexible authorization • Securely grant access to resources, including VPCs • Fine-grained control over who can call your functions Flexible use • Call or send events • Integrated with other AWS services • Build whole serverless ecosystems Using Lambda 14
  • 15. Lambda execution environment 15 Linux kernel version – 4.4.51- 40.60.amzn1.x86_64 Public Amazon Linux AMI version (AMI name: amzn- ami-hvm- 2016.03.3.x86_64-gp2) Image source: https://en.wikipedia.org/wiki/Linux_kernel
  • 16. Lambda runtime Lambda supports the following runtime versions: 16 Node.js • v4.3.2 • v6.10.2 Java • Java 8 Python • Python 3.6 • Python 2.7 .NET Core • .NET Core 1.0.1 (C#) Note: If you are using any native binaries in your code, make sure they are compiled in this environment. Also note that only 64-bit binaries are supported on AWS Lambda
  • 17. Three ways to create a Lambda function 17 Content source: https://aws.amazon.com/documentation/ Lambda AWS Lambda console (web User Interface) AWS SDK (Software Development Kit) AWS CLI (Command Line Interface)
  • 18. Deploying you code 18 There are three ways to deploy your code :
  • 19. Logging in AWS Lambda 19 Your Lambda function can contain logging statements. AWS Lambda writes these logs to CloudWatch. Logging can be done in two ways: Content source: https://aws.amazon.com/documentation/ Logging Print statements Language specific logging libraries
  • 20. Amazon CloudWatch logs  You can use Amazon CloudWatch Logs to monitor, store, and access your log files from AWS Lambda. You can then retrieve the associated log data from CloudWatch Logs  Archive Log Data—You can use CloudWatch Logs to store your log data in highly durable storage 20 Content source: https://aws.amazon.com/documentation/
  • 21. Accessing CloudWatch logs for lambda 21 Content source: https://www.slideshare.net/AmazonWebServices/aws-lambda-and-the-serverless-cloud
  • 22. Lambda limits 22 Content source: http://docs.aws.amazon.com/lambda/latest/dg/limits.html
  • 24. Lambda use cases 24 Content source: https://www.slideshare.net/AmazonWebServices/aws-lambda-and-the-serverless-cloud
  • 26. Python code sample 26 The code is available in the github repo: https://github.com/CodeOpsTechnologies/Real_time_retweets Prerequisites for the zip file: 1. Python-twitter module: The module must be installed into a separate folder. Use the modified pip command: pip install --target <target folder path> python-twitter Note: The python code uses boto3 module, but installing it is not required as it is available as a default module in AWS Lambda
  • 27. Steps to deploy code to Lambda 1. Create a zip file with the python code and dependency modules (python-twitter). 2. Create a Lambda function  Upload the zip file  Define environment variables and encrypt them 3. Create an event to schedule the lambda every one hour 27
  • 29. Encrypt Environment Variables 29 Enable encryption to encrypt the environment variables choose an encryption key
  • 30. Lambda function handler 30 handler is of the format: <python code file name>.lambda_handler IAM role with logging permissions
  • 31. Input to the Lambda 31 twitter user name you want to retweet from (without ‘@’)
  • 32. Schedule an event 32 choose ‘rules’ under ‘events’ in CouldWatch select ‘schedule’
  • 33. 33 schedule a fixed rate or as a cron expression Schedule an event
  • 34. Select target Lambda 34 select the target Lambda function
  • 35. Pass the input event 35 select ‘constant’ and add the input event in JSON format
  • 39. Serverless Summit Join us at India’s first conference on serverless technologies! 39

Editor's Notes