Coder Social home page Coder Social logo

aws_sample_codes3's Introduction

Serverless Reference Architecture: Real-time Stream Processing

README Languages: DE | ES | FR | IT | JP | KR | PT | RU | CN | TW

You can use AWS Lambda and Amazon Kinesis to process real-time streaming data for application activity tracking, transaction order processing, click stream analysis, data cleansing, metrics generation, log filtering, indexing, social media analysis, and IoT device data telemetry and metering. The architecture described in this diagram can be created with an AWS CloudFormation template.

The template does the following:

  • Creates a Kinesis Stream

  • Creates a DynamoDB table named <stackname>-EventData

  • Creates Lambda Function 1 (<stackname>-DDBEventProcessor) which receives records from Kinesis and writes records to the DynamoDB table

  • Creates an IAM Role and Policy to allow the event processing Lambda function read from the Kinesis Stream and write to the DynamoDB table

  • Creates an IAM user with permission to put events in the Kinesis stream together with credentials for the user to use in an API client

Instructions

Step 1 - Create an AWS CloudFormation stack with the template. The AWS CloudFormation template completely automates the building, deployment, and configuration of all the components of the application.

Launch Real-time Stream Processing into North Virginia with CloudFormation

Step 2 - Once the AWS CloudFormation stack has successfully been created you can do select the Outputs tab and see the AWS parameters needed in the demo Twitter client in the steps below.

Step 3 - To run the example application you need to update the code with AWS and Twitter information. Open producer/twitter2kinesis.py in a text editor.

Step 4 - To access the Twitter API you need to get access tokens. Make sure you have these available and enter the information in the following parameters:

The Twitter API parameters

consumer_key = ""
consumer_secret = ""
access_token_key = ""
access_token_secret = ""

Step 5 - Enter the values for the AWS credentials and Amazon Kinesis stream name. This is the information from the Outputs tab of the CloudFormation template you got in step 2:

AWS parameters - from the Outputs tab of the CloudFormation template

access_key = ""
secret_access_key = ""
region = ""
stream_name = ""

Step 6 - Finally, before running the example code, you need Python installed together with the Python modules boto3 and TwitterAPI. If you don't have the modules already, install them using pip:

pip install -r requirements.txt

Test

Client and Stream Processor Diagram

Step 1 - Run the producer/twitter2kinesis.py Python application from the command line to start sending tweets into the Kinesis stream.

python twitter2kinesis.py

Step 2 - In the Amazon DynamoDB management console, select the table named <stackname>-EventData and explore the records.

Cleanup

To remove all created resources, delete the AWS CloudFormation stack.

aws_sample_codes3's People

Contributors

aaronkao avatar hyandell avatar melwin avatar mikedeck avatar ronaldwidha avatar teknogeek0 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.