GithubHelp home page GithubHelp logo

wildcherrybazzaire / intro-to-aws Goto Github PK

View Code? Open in Web Editor NEW

This project forked from junior-devleague/intro-to-aws

0.0 1.0 0.0 17 KB

[Advanced] - Setting up AWS accounts and Serverless Framework

intro-to-aws's Introduction

AWS and Serverless

[Advanced] - AWS Intro, Set up AWS and Serverless, Lambda, API Gateway

What is AWS?

Amazon Web Services(AWS) is a platform of cloud computing which provides a simple way to access servers, storage, databases and a broad set of applications. We are basically renting out AWS servers to host our application instead of having to maintain our own. There are many type of services in AWS, each performing a specific functionality.

Why use AWS?

  • Low Cost - As developers, we pay end up paying less if we want to host our application on AWS servers. Since AWS has many active users, it drives down the cost of server use.
  • Advanced security features - Expert security staff are continually upgrading and maintaining servers.
  • Highly reliable - your data is matained in many different data centers just in case one goes down

What is Serverless Framework?

AWS allows us to access the their platform through programmatic access or AWS management console access. In this course, we will be using programmatic access through the Serverless Framework which allows us to access AWS through the command line and code editor.

What is AWS Lambda?

An AWS service that allows developers to run code without having to manage a server. No express server needed. A Lambda is basically a function in the cloud.

What is API Gateway?

An AWS service that enables developers to create, publish, maintain, monitor, and secure APIs at any scale. You can create APIs that access AWS or other web services, as well as data stored in the AWS Cloud. It allows developers to create CRUD routes(GET, POST, PUT, DELETE).

What does deploy mean?

Moving our application to the AWS cloud/servers. In our case, we will be deploying our Lambda function.

What will we be doing?

We will conifgure our AWS credentials and Serverless credentials, then will set up our Lambda function and API Gateway to deploy a GET url enpoint for our frontend client.

AWS Diagram

Configuring AWS and Serverless

  1. Your instructor should have provided you with a Access Key ID and a Secret Access Key. Please save them in a safe location.
  2. Open up your git-bash terminal
  3. Install aws-cli for windows
  4. Configure Access_ID, Secrect_Access_id, and region on our computer
    • Type aws configure then hit enter
      • Input the following
        • access_id
        • access_secret_id
        • region: us-west-2
  5. npm install Serveless Framework npm install -g serverless
  6. Set Serverless provider credentials
serverless config credentials --provider aws --key YOUR_ACCESS_KEY --secret YOUR_SECRET_KEY

Create Serveless Template and Lambda Function

  1. Create a new directory/projectmkdir YOUR_PROJECT_NAME
  2. CD into your directory/project cd YOUR_PROJECT_NAME
  3. Create boilerplate/template to use Serverless**
serverless create --template aws-nodejs
  1. Change service name in serverless.yml file
  2. Uncomment the following:*
stage: dev
region: us-east-1
  • Then set region to us-west-2
  1. Test Lambda function locally
serverless invoke local -f FUNCTION_NAME 
  1. Deploy your code
serverlesss deploy
  1. Change message in lambda function then redeploy function only
serverless deploy -f FUNCTION_NAME
  1. Invoke deployed function
serverless invoke -f FUNCTION_NAME
  1. If need help with serverless commands
serverless --help

** Create API Gateway GET request

Congratulations you have made your first deployment

Class Exercise

  1. Create a GET request to your Lambda function, then render out text Hello World! in your frontend

Hint: create file structure in your root path for you frontend

serverless-demo
|
+ --public
    |
    +-- index.html
    +-- styles.css
    +-- app.js
  1. Create a GET request to your Lambda function, which calls the Chuck Norris API random jokes endpont. Render out a random joke to your frontend everytime you refresh your browser.

Resources

What is AWS?

How does Amazon Web Services (AWS) work? - Quora

Serverless Framework - AWS Lambda Guide - Quick Start

AWS Services

What Is AWS Lambda?

What Is Amazon API Gateway?

intro-to-aws's People

Contributors

jaygiang avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.