NOTICE: AWS AppSync is not part of Free tier and some AWS services used may not be covered by the Free tier after 12 months.
Before you deploy, you must have the following in place:
- AWS Account
- Python 3.7 or greater
- Node 8.10 or greater
- Amplify CLI 3.17.0 or greater installed and configured
- SAM CLI
- Docker
- Stripe Account
- Take note of your testing
Secret Key
andPublic Key
located in the Stripe Dashboard
- Take note of your testing
Follow these instructions to deploy the Serverless Airline application:
- Fork this project and take note of the url
- Within an empty directory, initialize the project with
amplify init --app <fork-github-url>
- Choose to create a new environment (i.e. dev)
- Verify that you now have at least
Auth
andApi
categories by runningamplify status
- Deploy amplify managed infrastructure by running
amplify push
- Once complete, open AWS Amplify Console
- If this is your first time using Amplify Console, select
Deploy
- If this is your first time using Amplify Console, select
- Click on
Connect app
, selectGitHub
, choose your Fork repo and select the branchdevelop
- Under "Existing Amplify backend detected", select your new environment created in Step 2
- Choose an existing Amplify Console IAM Role or create a new one
At the end of the first deployment, you should have a new URL where you can visit and sign the first user up - Next steps being setup payment and add flights.
NOTE: We're currently working on an ETL feature to automatically add flights as part of CI.
Public key for tokenizing card data during flight booking
- Within your fork, open front-end environment variable file
src/frontend/.env
- Update the value of
VUE_APP_StripePublicKey
with your Stripe public key
Secret key for collecting pre-authorized charges
- Within AWS Amplify Console, select your App and expand
Environment Variables
- Add
STRIPE_SECRET_KEY
environment variable and its value
Provided you have followed deployment instructions and signed up your first user, take the steps below to log in to AWS AppSync and run a createFlight
mutation:
- Open Amplify variable file
src/frontend/aws-exports.js
and take note ofaws_user_pools_web_client_id
- Go to the AWS AppSync Console, and select the
Serverless Airline API
- Go to
Queries
on the left menu, and selectLogin with User Pools
- Within
ClientId
use the value you took note inStep 1
, and use the credentials of your newly created Cognito user - Within your fork, copy any of the
createFlight
mutations provided insample-queries-mutations.gql
- Open up the front-end, and search for a flight from
LGW
toMAD
for December 2nd, 2019
To delete the Serverless Airline from your AWS Account, you need:
- Git branch name - Branch you connected in Amplify Console (e.g. twitch)
- Root Stack name - Root CloudFormation Stack name, available in System Manager Parameter Store (e.g. /twitch/stackName)
By running the commands below within the project source code, you will
- Fetch the root stack name into STACK_NAME environment variable
- Export the
git branch name
used in Amplify Console - you need to replace with the correct value - Delete all back-ends managed by Serverless Application Model (SAM) in the correct order
- Delete all resources managed by Amplify (API, DynamoDB Table, Cognito)
# export AWS_BRANCH="twitch"
export AWS_BRANCH="<<Git Branch Name you used>>"
export STACK_NAME=$(aws ssm get-parameter --name /${AWS_BRANCH}/service/amplify/deployment/stackName --query 'Parameter.Value' --output text)
make delete
amplify delete
Lastly, deployment S3 buckets may remain untouched. You can safely delete buckets starting with awsserverlessairline-<<<timestamp>>>-deployment
, use either via Console, CLI or SDK