Archive tweets and make them searchable

Overview

Tweeter

Archive and search your tweets and liked tweets using AWS Lambda, DynamoDB and Elasticsearch.

Note: this project is primarily being used a test bed for figuring out best practices with AWS Lambda

Architecture

Requirements

Make sure you have the following installed before you proceed

Setup

Twitter API key setup

Set up a Twitter Developer account. Once you are signed up, create an app.

Add the credentials to SSM Parameter Store:

aws ssm put-parameter --name /tweeter/twitter/consumer_key --value <your consumer key value> --type SecureString --overwrite
aws ssm put-parameter --name /tweeter/twitter/consumer_secret --value <your consumer secret value> --type SecureString --overwrite
aws ssm put-parameter --name /tweeter/twitter/access_token --value <your access token value> --type SecureString --overwrite
aws ssm put-parameter --name /tweeter/twitter/access_token_secret --value <your access token secret value> --type SecureString --overwrite

Elastic Cloud setup

Elastic Cloud is not free

Set up an account with Elastic Cloud. Create a deployment and then an Elastic App Search engine. Retrieve the private key from the Credentials section.

Add the private key to SSM.

aws ssm put-parameter --name /tweeter/es/private_key --value <your password> --type SecureString --overwrite

Also, update the configuration in ui/src/config/engine.json, specifically the values of endpointBase and searchKey.

Deploy the backend

Build and deploy your application for the first time by running the following commands in your shell:

make build
make deploy.guided

The first command will build the source of your application within a Docker container. The second command will package and deploy your application to AWS. Guided deploy means SAM CLI will ask you about the name of your deployment/stack, AWS Region, and whether you want to save your choices, so that you can use make deploy next time.

Deploy the frontend

In the ui directory, deploy the application with AWS Amplify.

amplify publish

Use the SAM CLI to build and test locally

Whenever you change your application code, you'll have to run build command:

make build

The SAM CLI installs dependencies defined in poller/requirements.txt, creates a deployment package, and saves it in the .aws-sam/build folder.

Test a single function by invoking it directly with a test event:

make invoke.poller
make invoke.indexer

Working with localstack

Validate DynamoDB was populated using Localstack:

docker-compose up -d
make invoke.poller
aws --endpoint-url=http://localhost:4566 dynamodb scan --table-name TweetsTable --max-items 10

An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the events folder in this project.

Fetch, tail, and filter Lambda function logs

To simplify troubleshooting, SAM CLI has a command called sam logs. sam logs lets you fetch logs generated by your deployed Lambda function from the command line. In addition to printing the logs on the terminal, this command has several nifty features to help you quickly find the bug.

NOTE: This command works for all AWS Lambda functions; not just the ones you deploy using SAM.

sam logs -n TweeterPoller --stack-name tweeter --tail

You can find more information and examples about filtering Lambda function logs in the SAM CLI Documentation.

CI/CD with GitHub

Backend

Create a user github with the following policy: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-permissions.html.

Create secrets with AWS.

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY

Frontend

Follow the AWS Amplify console to configure the frontend.

Notes

  1. Set StreamModeEnabled to false in samconfig.toml the first time you run the poller to get all tweets.
  2. Twitter apparently only allows access to a user's most recent 3,240 tweets with this method.
  3. This probably isn't the best use case for Lambda, which has a timeout of 15 minutes. Ideally we should be calling Fargate for long running task. That said, in practice, because of the limitations of Twitter's API, getting all the available tweets is well within that limit.

Appendix: Powertools

Tracing

Tracer utility patches known libraries, and trace the execution of this sample code including the response and exceptions as tracing metadata - You can visualize them in AWS X-Ray.

Logger

Logger utility creates an opinionated application Logger with structured logging as the output, dynamically samples 10% of your logs in DEBUG mode for concurrent invocations, log incoming events as your function is invoked, and injects key information from Lambda context object into your Logger - You can visualize them in Amazon CloudWatch Logs.

Metrics

Metrics utility captures cold start metric of your Lambda invocation, and could add additional metrics to help you understand your application KPIs - You can visualize them in Amazon CloudWatch.

License

MIT

A FORKED AND Modded version of TL:GD for 🅱️3R0K🧲support

for support join here working example group Leech Here For Any Issues/Imrovements or Discussions go here or here Please Leave A star And Fork this Rep

KangersHub 202 Dec 26, 2022
🦈 Blahaj is a discord bot that shares random images of himself on discord.

🦈 Blahaj Bot Blahaj is a discord bot that shares random images of himself on discord. ⚙️ Developer's Guide To use the bot, follow along the steps Hea

Atul Anand 3 Oct 21, 2022
An async python wrapper to interact with the Steam API and its CMs

steam.py A modern, easy to use, and async ready package to interact with the Steam API. Heavily inspired by discord.py and borrowing functionality fro

James Hilton-Balfe 90 Dec 15, 2022
A collection of tools for managing Jira issues for the RHODS project

RHODS-Jira-Tools A collection of tools for managing Jira issues for the RHODS project move_to_qa.py This script handles transitioning a given Jira iss

Alex Corvin 1 Sep 20, 2022
A new coin listing alert bot using Python, Flask, MongoDB, Telegram API and Binance API

Bzzmans New Coin Listing Detection Bot Architecture About Project Work in progress. This bot basically gets new coin listings from Binance using Binan

Eyüp Barlas 21 May 31, 2022
⚡ PoC: Hide a c&c botnet in the discord client. (Proof Of Concept)

👨‍💻 Discord Self Bot 👨‍💻 A Discord Self-Bot in Python by natrix Installation Run: selfbot.bat Python: version : 3.8 Modules

0хVιcнy#1337 37 Oct 21, 2022
unofficial source of the discord bot, “haunting.” created by: vorqz, vert, & Veltz

hauntingSRC unofficial source of the discord bot, “haunting.” created by: vorqz, vert, & Veltz reasoning: creators skidded the most of this bot and do

Vast 11 Nov 04, 2022
Wallpaper API from wallpaperscraft.com

wallpaper-api Wallpaper API from https://wallpaperscraft.com for API documentation see https://maajid-wallpaper-api.deta.dev/docs How to Run first, cl

Athallah Muhammad Maajid 2 Apr 06, 2022
An EmbedBuilder for Discord bots in Python.

An EmbedBuilder for Discord bots in Python. You need discord.py to use this module.

6 Jan 13, 2022
Definitive Guide to Creating a SQL Database on Cloud with AWS and Python

Definitive Guide to Creating a SQL Database on Cloud with AWS and Python An easy-to-follow comprehensive guide on integrating Amazon RDS, MySQL Workbe

Kenneth Leung 6 Aug 17, 2022
Shows VRML team stats of all players in your pubs

VRML Team Stat Searcher Displays Team Name, Team Rank (Worldwide), and tier of all the players in your pubs. GUI WIP: Username search works & pub name

Hamish 2 Dec 22, 2022
Senexia - A powerful telegram bot to manage your groups as effectively as possible

⚡ Kenechi bot ⚡ A Powerful, Smart And Simple Group Manager ... Written with AioG

Akhi 2 Jan 11, 2022
Telegram 聊天機器人,追蹤momo降價、重新上架

簡介 price-tracker-bot is a telegram bot that can trace the price on momoshop. 功能 降價通知 上架通知 收藏商品 清空已收藏商品 顯示目前已收藏商品 Demo Bot Telegram bot search @momo_pr

92 Dec 28, 2022
An advanced telegram movie information finder bot

An advanced telegram movie information finder bot

Fayas Noushad 22 Aug 23, 2022
Sie_banxico - A python class for the Economic Information System (SIE) API of Banco de México

sie_banxico A python class for the Economic Information System (SIE) API of Banco de México. Args: token (str): A query token from Banco de México id_

Dillan 2 Apr 07, 2022
The Research PACS on AWS solution facilitates researchers' access medical images stored in the clinical PACS in a secure and seamless manner

Research PACS on AWS Challenge to solve Solution presentation Deploy the solution Further reading Releases License Challenge to solve The rise of new

AWS Samples 23 Sep 09, 2022
Sielzz Music adalah proyek bot musik telegram, memungkinkan Anda memutar musik di telegram grup obrolan suara.

Hi, I am: Requirements 📝 FFmpeg NodeJS nodesource.com Python 3.8 or higher PyTgCalls MongoDB Get STRING_SESSION from below: 🎖 History Features 🔮 Th

1 Nov 29, 2021
A custom Discord Rich Presence to display when you're studying so you're stupid friends won't disturb you when you're studying.

Studying RPC Description A custom Discord Rich Presence to display when you're studying so you're stupid friends won't disturb you when you're studyin

John Edmerson Pizarra 4 Nov 19, 2022
Biblioteca Python que extrai dados de mercado do Bacen (Séries Temporais)

Pybacen This library was developed for economic analysis in the Brazilian scenario (Investments, micro and macroeconomic indicators) Installation Inst

42 Jan 05, 2023
Telegram bot to scrape images from the reddit universe

Telegram bot to scrape images from the reddit universe

XD22 3 Sep 30, 2022