1.0.15 • Published 6 years ago

raml2serverless v1.0.15

Weekly downloads
2
License
ISC
Repository
-
Last release
6 years ago

RAML2Serverless

This tool is built to support the Development and Deployment phases of RESTful APIs to be deployed as server-less implementations on the AWS Platform. This tool takes the RESTful API design/specification in RAML format and generates the following:

Source Code Templates - (currently for node.js). These are empty function definitions as expected by AWS Lambda. These map to the resource-methods on AWS API Gateway

CloudFormation Template - This has the definition for the Lambda Functions and the mapping to corresponding resource-definition on AWS API Gateway. The template is simple and readable and uses the AWS Serverless Application Model (SAM).

We can then provide the implementation for the generated code and then execute some commands to deploy ( or redeploy) the code to AWS.

This requires us to initialize the AWS CLI.

Installation & Usage

Install: npm install -g raml2serverless

Navigate to any directory of your choice :

cd some-custom-location

Run the following command to process the RAML file :

raml2serverless <name-or-relative-path-to-RAMLfile>

e.g. 

raml2serverless ./Pets.RAML

CloudFormation Template and Source Code Templates will be created in the "output" directory

Deployment (updates) to AWS

Initialize the AWS CLI

Create a S3 bucket with full-permissions for the user (This is for uploading source-code. You can use an existing bucket)

Use the following command to upload the code to S3 and get an updated CloudFormation template.

aws cloudformation package --template <cloudformation-template> --s3-bucket <S3 bucket> --output json <updated-cloudformation-template>

Use the following command to create or update the resources on AWS (This will create Roles, Policies, Lambda Functions, API Gateway Definitions and deployments)

aws cloudformation deploy --template <updated-cloudformation-template> --stack-name <stack-name> --capabilities CAPABILITY_IAM  

Test the API by calling the AWS API Gateway Endpoint.

License

MIT

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago