Coder Social home page Coder Social logo

signalwhisperer / meet-sam Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 72 KB

A basic demonstration of a Rust project using a SAM template to deploy on AWS.

Rust 97.27% Makefile 0.55% Shell 2.18%
aws cfn-template lambda-functions rust sam-template

meet-sam's Introduction

Meet SAM

A basic demonstration of a Rust project using a SAM template to deploy on AWS. There are many workaround required due to issues in the SAM CLI. DO NOT USE THIS IN A PRODUCTION ENVIRONMENT. THIS IS JUST AN EXAMPLE OF HOW TO USE RUST WITH SAM TEMPLATES AND NOT A SECURE, ROBUST SOLUTION.

Diagram

alt Project Diagram

Build

Some workarounds are required to build the project so the SAM CLI can use it correctly. Run the ./build script to build the project as it is.

Deploy

Simply run sam deploy -g to have a guided deployment, or sam deploy if you already have a samconfig.toml file created.

Test

You can call the API it created with the following Postman collection. Make sure to update the variables and to change message-id from Get Message and Delete Message for the actual message ID.

{
  "info": {
    "name": "Meet SAM",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "List Messages",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{endpoint}}/",
          "host": [
            "{{endpoint}}"
          ],
          "path": [
            ""
          ]
        }
      }
    },
    {
      "name": "Get Message",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{endpoint}}/message-id",
          "host": [
            "{{endpoint}}"
          ],
          "path": [
            "message-id"
          ]
        }
      }
    },
    {
      "name": "Delete Message",
      "request": {
        "method": "DELETE",
        "header": [],
        "url": {
          "raw": "{{endpoint}}/message-id",
          "host": [
            "{{endpoint}}"
          ],
          "path": [
            "message-id"
          ]
        }
      }
    },
    {
      "name": "Send Message",
      "request": {
        "method": "POST",
        "header": [],
        "body": {
          "mode": "raw",
          "raw": "{\n    \"from\": \"me\",\n    \"subject\": \"Hello World\",\n    \"contents\": \"It works!\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{endpoint}}/",
          "host": [
            "{{endpoint}}"
          ],
          "path": [
            ""
          ]
        }
      }
    }
  ],
  "variable": [
    {
      "key": "api-id",
      "value": "",
      "type": "default"
    },
    {
      "key": "region",
      "value": "",
      "type": "default"
    },
    {
      "key": "endpoint",
      "value": "https://{{api-id}}.execute-api.{{region}}.amazonaws.com",
      "type": "default"
    }
  ]
}

meet-sam's People

Contributors

signalwhisperer avatar

Watchers

 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.