All Projects → DavidWittman → serverless-southwest-check-in

DavidWittman / serverless-southwest-check-in

Licence: MIT license
🕐 ✈️ 👍 Automated Southwest Check-Ins powered by AWS Lambda and Step Functions

Programming Languages

python
139335 projects - #7 most used programming language
HCL
1544 projects
Makefile
30231 projects

Projects that are alternatives of or similar to serverless-southwest-check-in

southwest-checkin
Easy-to-use gem to check in to Southwest flights automatically. Also supports sending email notifications.
Stars: ✭ 67 (+36.73%)
Mutual labels:  southwest-flights
tibanna
Tibanna helps you run your genomic pipelines on Amazon cloud (AWS). It is used by the 4DN DCIC (4D Nucleome Data Coordination and Integration Center) to process data. Tibanna supports CWL/WDL (w/ docker), Snakemake (w/ conda) and custom Docker/shell command.
Stars: ✭ 61 (+24.49%)
Mutual labels:  aws-step-function
telegram-stepfunctions-bot
Serverless Telegram bot made on 4 AWS Lambda chained by AWS Step Functions. All of this written on Serverless Framework using plugins.
Stars: ✭ 26 (-46.94%)
Mutual labels:  aws-step-function

Serverless Southwest Check In

Build Status

Serverless Southwest Check In is an email bot which will automatically check you into your Southwest flights. Never sit in a middle seat again!

This project is powered by the AWS Serverless Platform (Lambda, Step Functions, and SES) and was inspired by similar projects from Aaron Ortbals and Joe Beda.

Quickstart

Installation

Skip to the Deploy section if you already have Terraform installed and configured with your AWS credentials.

Requirements

  • Terraform 0.12+. Install this first.
  • AWS IAM user credentials with Administrator access (for Terraform)
  • A Route53 hosted zone for receiving emails via SES

Configure your AWS Credentials

Add your credentials to your environment, with aws configure, or directly with Terraform.

Here's an example of setting your credentials via environment variables. For more detailed explanations, see the Terraform AWS Provider documentation.

$ export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
$ export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_KEY
$ export AWS_DEFAULT_REGION=us-east-1

Initialize Terraform state

Run the following command to configure Terraform's Remote State in S3.

$ terraform init terraform/

You will be prompted for an S3 location to store the remote statefile in. If you wish to use a local state, just remove terraform/backend.tf and rerun this command.

Usage

Terraform Variables

You need to either specify your variables in a terraform.tfvars file, or you will be prompted for the variables during the deploy.

You can rename the terraform.tfvars.example to terraform.tfvars and edit it. Alternatively, you can skip to the Deploy section below in which you will be prompted for the following variables:

  • var.admin_email: Administrator email to receive confirmations and alerts.
  • var.domains: List of domains that already have a Route 53 hosted zone configured. The MX record for this domain name will be set to the SES SMTP receiver endpoints for your region, so choose a domain which you do not currently use to receive email. Must be formatted as a list. For example: ["domain.com"]
  • var.recipients: List of email addresses that can receive a forwarded check-in. Must be formatted as a list. For example: ["[email protected]"]
  • var.feedback_email: An email address under one of the domains which receives user feedback. e.g. [email protected]. All mail sent to this address is directed to an SNS topic and not processed any further.
  • provider.aws.region: AWS region in which to deploy

Deploy

To package, build, and deploy to AWS, run:

$ make deploy

Or, if you don't have make installed:

$ pip install -r lambda/requirements.txt -t lambda/vendor/python && terraform apply terraform/

Add a flight

New flights can be added by an SES email trigger or by manually executing an AWS Step Function.

Add via Email

Forward your reservation email to the email address set above as var.recipients. The reservation email is sent by Southwest at purchase time and should be in the form:

Flight reservation (ABC123) | 25DEC17 | ABC-XYZ | LASTNAME/FIRSTNAME

Manually execute Step Function

Start an execution of the sw-check-in Step Function via the AWS cli, passing in your check-in details in JSON as input. Here's an example:

STEP_FN_INPUT='{
  "first_name": "George",
  "last_name": "Bush",
  "confirmation_number": "ABC123",
  "email": "[email protected]"
}'
STEP_FN_ARN=$(aws --output text stepfunctions list-state-machines --query 'stateMachines[*].stateMachineArn' | grep -E ':sw-check-in$')
aws stepfunctions start-execution \
  --state-machine-arn "$STEP_FN_ARN" \
  --input "$STEP_FN_INPUT"

The email parameter is optional and sets the email address to which notifications will be sent.

Other

Notifications

An SNS topic checkin-notifications is created as part of the Terraform deploy, but you must manually create and attach a subscription to it through the SNS dashboard. See the Amazon documentation on how to Subscribe to a Topic for more information.

Contributing

Testing

To run tests, you must first have the requirements provided in lambda/requirements-dev.txt installed:

$ pip install -r lambda/requirements-dev.txt

After you have installed the test dependencies, you can run the test suite with:

# unit tests
$ make test
# flake8 style check
$ make lint
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].