- Open AWS Console. Search and open AWS Lambda Service.
- Create the first Lambda function
- Name:
collect_tweets
- Runtime:
python 3.9
- Leave everything else as default, and create the function
- Upload the collect_tweets.zip
- In Configuration/General configuration:
- Memory:
500 MB
- Ephemeral storage:
1000 MB
- Timeout:
1 min
- Memory:
- In Configuration/Environment variables, create the following variables and provide corresponding values:
api_key
api_secret
access_token
access_secret
mongodb_connect
database_name
geocode
q_parameter
- In Test, create a new event to test the function.
- If the test is successful, add a trigger:
- Source:
EventBridge
- Create a new rule
- Name:
every5min
- Schedule expression:
rate(5 minutes)
- Source:
- Name:
- Create the second Lambda function
- Name:
sentiment_tweets
- Runtime:
python 3.9
- Leave everything else as default, and create the function
- Upload the sentiment_tweets.zip
- In Configuration/General configuration:
- Memory:
500 MB
- Ephemeral storage:
1000 MB
- Timeout:
1 min
- Memory:
- In Configuration/Environment variables, create the following variables and provide corresponding values:
mongodb_connect
database_name
lang
- In Test, create a new event to test the function.
- If the test is successful, add a trigger:
- Source:
EventBridge
- Use existing rule:
every5min
- Source:
- Name:
- Log in to the MongoDB website and find the database that contains the collected tweets.
- Open MongoDB Chart and add a dashboard. Use the final project database as the data resource. Create the following charts and add filters to all charts to show the data from the last 60 mins.
- A number chart to show the total number of collected Tweets
- A line chart to show the number of Tweets in different sentiments over time. Use the local time zone.
- A word cloud to show the top 50 popular hashtags
- A bar chart to show the top 10 active Twitter users
- A table to show the Twitter texts, number of favorites, positive scores, and negative scores.