Skip to content

Serverless Deployment Manual

Jordan Seow edited this page Nov 15, 2019 · 6 revisions

Prerequisite

Making changes

  1. Fork https://github.com/jordseow/CodeTranslate.git
  2. Open UnitOne.vue and UnitTwo.vue, and change firebaseUrl in data to your own Firebase URL
    • firebaseUrl = "<your-firebase-url>"
  3. Edit any other changes you want to the app
  4. Run npm run build
  5. Commit your changes to your forked repository

Using AWS SAM

  1. Create Cloud9 environment on AWS
  2. Use bash window to clone repository into the new environment
    • git clone <your-repository>
  3. Update SAM CLI version on Cloud9
    • chmod +x c9-setup.sh
    • ./c9-setup.sh
  4. Change to new terminal for changes to take effect
    • Run sam --version to check your version (v0.22.0)
  5. Build app for your region (e.g. North Virginia us-east-1 or Singapore ap-southeast-1)
    • sam build --region ap-southeast-1
  6. Locally invoke lambda function
    • echo '{"httpMethod":"GET"}' | sam local invoke "<function-name>"
  7. Start the API locally
    • `sam local start-api
  8. Make new S3 bucket with unique name
    • aws s3 mb s3://<s3-bucket-name> --region ap-southeast-1
  9. Run the package command to generate packaged.yaml file
    • `sam package --output-template packaged.yaml --s3-bucket
  10. Deploy CloudFormation stack
    • `sam deploy --template-file packaged.yaml --region ap-southeast-1 --capabilities CAPABILITY_IAM--stack-name <cloudformation-stack-name-to-be-created

Deploy

  1. Run npm install --save serverless-finch
  2. Run npx serverless config credentials -o --provider aws --key AWS_ACCESS_KEY_ID --secret AWS_SECRET_ACCESS_KEY
  3. Run npm run deploy
  4. Access your serverless app from your browser

Clone this wiki locally