Serverless Developer Guide
metadata and to collect metrics. Data is sent to Amazon OpenSearch Service for application 
monitoring and forensic analysis. The services aggregate, analyze, and visualize data to provide 
real-time insights that help the team ﬁnd and ﬁx streaming issues as they happen. For more 
information on this speciﬁc use-case, see Using AWS to Deliver Streaming Experience to More 
Than 18 Million Football Fans
To implement serverless streaming in similar scenarios, you can use the following AWS services 
together.
• AWS Lambda — For compute processing tasks.
• Amazon Kinesis — For collecting, processing, and analyzing real-time and streaming data.
• Amazon DynamoDB & Amazon S3 — For storing and retrieving data and ﬁles.
Stateless data
When building Lambda functions, you should assume that the environment exists only for a single 
invocation. The function should initialize any required state when it is ﬁrst started – for example, 
fetching a shopping cart from a DynamoDB table. It should commit any permanent data changes 
before exiting to a durable store such as Amazon S3, DynamoDB, or Amazon SQS. It should not rely 
on any existing data structures or temporary ﬁles, or any internal state that would be managed by 
multiple invocations (such as counters or other calculated, aggregate values).
Lambda provides an initializer before the handler where you can initialize database connections, 
libraries, and other resources. Since execution environments are reused where possible to 
improve performance, you can amortize the time taken to initialize these resources over multiple 
invocations. However, you should not store any variables or data used in the function within this 
global scope.
Stateless data 7