Skip to content

Commit

Permalink
Merge branch 'master' into improve-apigw-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
horike37 committed Mar 12, 2018
2 parents 4aa9e80 + c7ac0bd commit 6192e0b
Show file tree
Hide file tree
Showing 137 changed files with 4,367 additions and 2,215 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -52,3 +52,7 @@ jest

# VIM
*.swp

# DotNet
[Bb]in/
[Oo]bj/
19 changes: 19 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,22 @@
# 1.26.1 (27.02.2018)
- [Fix lambda integration regression](https://github.com/serverless/serverless/pull/4775)

## Meta
- [Comparison since last release](https://github.com/serverless/serverless/compare/v1.26.0...v1.26.1)

# 1.26.0 (29.01.2018)
- [AWS Go support](https://github.com/serverless/serverless/pull/4669)
- [Support for using an existing ApiGateway and Resources](https://github.com/serverless/serverless/pull/4247)
- [Add logRetentionInDays config](https://github.com/serverless/serverless/pull/4591)
- [Add support of `serverless.js` configuration file](https://github.com/serverless/serverless/pull/4590)
- [Add "did you mean..." CLI suggestions](https://github.com/serverless/serverless/pull/4586)
- [Add `--template-path` option to `serverless create`](https://github.com/serverless/serverless/pull/4576)
- [Add support POJO input support for Java invoke local](https://github.com/serverless/serverless/pull/4596)

## Meta
- [Comparison since last release](https://github.com/serverless/serverless/compare/v1.25.0...v1.26.0)


# 1.25.0 (20.12.2017)
- [Improve Stage and Region Usage](https://github.com/serverless/serverless/pull/4560)
- [Add API Gateway endpoint configuration](https://github.com/serverless/serverless/pull/4531)
Expand Down
8 changes: 5 additions & 3 deletions README.md
Expand Up @@ -12,7 +12,7 @@

**The Serverless Framework** – Build applications comprised of microservices that run in response to events, auto-scale for you, and only charge you when they run. This lowers the total cost of maintaining your apps, enabling you to build more logic, faster.

The Framework uses new event-driven compute services, like AWS Lambda, Google CloudFunctions, and more. It's a command-line tool, providing scaffolding, workflow automation and best practices for developing and deploying your serverless architecture. It's also completely extensible via plugins.
The Framework uses new event-driven compute services, like AWS Lambda, Google Cloud Functions, and more. It's a command-line tool, providing scaffolding, workflow automation and best practices for developing and deploying your serverless architecture. It's also completely extensible via plugins.

Serverless is an MIT open-source project, actively maintained by a full-time, venture-backed team.

Expand Down Expand Up @@ -126,12 +126,13 @@ The following are services you can instantly install and use by running `serverl
* [Ruby](https://github.com/stewartlord/serverless-ruby) - Call a Ruby function from your lambda
* [Slack App](https://github.com/johnagan/serverless-slack-app) - Slack App Boilerplate with OAuth and Bot actions
* [Swift](https://github.com/choefele/swift-lambda-app) - Full-featured project template to develop Lambda functions in Swift
* [Cloudwatch Alerts on Slack](https://github.com/dav009/serverless-aws-alarms-notifier) - Get AWS Cloudwatch alerts notifications on Slack

**Note**: the `serverless install` command will only work on V1.0 or later.

## <a name="features"></a>Features

* Supports Node.js, Python, Java, Scala, C#, F#, Groovy, Kotlin, PHP & Swift.
* Supports Node.js, Python, Java, Scala, C#, F#, Go, Groovy, Kotlin, PHP & Swift.
* Manages the lifecycle of your serverless architecture (build, deploy, update, delete).
* Safely deploy functions, events and their required resources together via provider resource managers (e.g., AWS CloudFormation).
* Functions can be grouped ("serverless services") for easy management of code, resources & processes, across large projects & teams.
Expand All @@ -157,7 +158,7 @@ This table is generated from https://github.com/serverless/plugins/blob/master/p
| **[Raml Serverless](https://github.com/andrewcurioso/raml-serverless)** <br/> Serverless plugin to work with RAML API spec documents | [andrewcurioso](http://github.com/andrewcurioso) |
| **[Serverless Alexa Plugin](https://github.com/rajington/serverless-alexa-plugin)** <br/> Serverless plugin to support Alexa Lambda events | [rajington](http://github.com/rajington) |
| **[Serverless Api Stage](https://github.com/leftclickben/serverless-api-stage)** <br/> Serverless API Stage plugin, enables stage variables and logging for AWS API Gateway. | [leftclickben](http://github.com/leftclickben) |
| **[Serverless Apig S3](https://github.com/sdd/serverless-apig-s3)** <br/> Serve static front-end content from S3 via the API Gatewy and deploy client bundle to S3. | [sdd](http://github.com/sdd) |
| **[Serverless Apig S3](https://github.com/sdd/serverless-apig-s3)** <br/> Serve static front-end content from S3 via the API Gateway and deploy client bundle to S3. | [sdd](http://github.com/sdd) |
| **[Serverless Apigateway Plugin](https://github.com/GFG/serverless-apigateway-plugin)** <br/> Configure the AWS api gateway: Binary support, Headers and Body template mappings | [GFG](http://github.com/GFG) |
| **[Serverless Apigw Binary](https://github.com/maciejtreder/serverless-apigw-binary)** <br/> Plugin to enable binary support in AWS API Gateway. | [maciejtreder](http://github.com/maciejtreder) |
| **[Serverless Apigwy Binary](https://github.com/ryanmurakami/serverless-apigwy-binary)** <br/> Serverless plugin for configuring API Gateway to return binary responses | [ryanmurakami](http://github.com/ryanmurakami) |
Expand Down Expand Up @@ -262,6 +263,7 @@ This table is generated from https://github.com/serverless/examples/blob/master/
-->
| Project Name | Author |
|:-------------|:------:|
| **[Serverless Architecture Boilerplate](https://github.com/msfidelis/serverless-architecture-boilerplate)** <br/> Boilerplate to organize and deploy big projects using Serverless and CloudFormation on AWS | [msfidelis](http://github.com/msfidelis) |
| **[Jwtauthorizr](https://github.com/serverlessbuch/jwtAuthorizr)** <br/> Custom JWT Authorizer Lambda function for Amazon API Gateway with Bearer JWT | [serverlessbuch](http://github.com/serverlessbuch) |
| **[Serverless Graphql Api](https://github.com/boazdejong/serverless-graphql-api)** <br/> Serverless GraphQL API using Lambda and DynamoDB | [boazdejong](http://github.com/boazdejong) |
| **[Serverless Screenshot](https://github.com/svdgraaf/serverless-screenshot)** <br/> Serverless Screenshot Service using PhantomJS | [svdgraaf](http://github.com/svdgraaf) |
Expand Down
12 changes: 11 additions & 1 deletion docker-compose.yml
Expand Up @@ -60,9 +60,19 @@ services:
volumes:
- ./tmp/serverless-integration-test-aws-csharp:/app
aws-fsharp:
image: microsoft/dotnet:1.0.4-sdk
image: microsoft/dotnet:2.0-sdk
volumes:
- ./tmp/serverless-integration-test-aws-fsharp:/app
aws-go:
image: golang:1.9
volumes:
- ./tmp/serverless-integration-test-aws-go:/app
- ./tmp/serverless-integration-test-aws-go:/go/src/app
aws-go-dep:
image: yunspace/golang:1.9
volumes:
- ./tmp/serverless-integration-test-aws-go-dep:/app
- ./tmp/serverless-integration-test-aws-go-dep:/go/src/app
aws-nodejs-typescript:
image: node:6.10.3
volumes:
Expand Down
31 changes: 29 additions & 2 deletions docs/providers/aws/events/alexa-skill.md
Expand Up @@ -14,14 +14,41 @@ layout: Doc

## Event definition

This will enable your Lambda function to be called by an Alexa skill kit.
This will enable your Lambda function to be called by an Alexa Skill kit.
`amzn1.ask.skill.xx-xx-xx-xx-xx` is a skill ID for Alexa Skills kit. You receive a skill ID once you register and create a skill in [Amazon Developer Console](https://developer.amazon.com/).
After deploying, add your deployed Lambda function ARN to which this event is attached to the Service Endpoint under Configuration on Amazon Developer Console.

```yml
functions:
mySkill:
handler: mySkill.handler
events:
- alexaSkill
- alexaSkill: amzn1.ask.skill.xx-xx-xx-xx-xx
```

You can find detailed guides on how to create an Alexa Skill with Serverless using NodeJS [here](https://github.com/serverless/examples/tree/master/aws-node-alexa-skill) as well as in combination with Python [here](https://github.com/serverless/examples/tree/master/aws-python-alexa-skill).

## Enabling / Disabling

**Note:** `alexaSkill` events are enabled by default.

This will create and attach a alexaSkill event for the `mySkill` function which is disabled. If enabled it will call
the `mySkill` function by an Alexa Skill.

```yaml
functions:
mySkill:
handler: mySkill.handler
events:
- alexaSkill:
appId: amzn1.ask.skill.xx-xx-xx-xx
enabled: false
```

## Backwards compatibility

Previous syntax of this event didn't require a skill ID as parameter, but according to [Amazon's documentation](https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#configuring-the-alexa-skills-kit-trigger) you should restrict your lambda function to be executed only by your skill.

Omitting the skill id will make your Lambda function available for the public, allowing any other skill developer to invoke it.

(This is important, as [opposing to custom HTTPS endpoints](https://developer.amazon.com/docs/custom-skills/handle-requests-sent-by-alexa.html#request-verify), there's no way to validate the request was sent by your skill.)
15 changes: 9 additions & 6 deletions docs/providers/aws/events/apigateway.md
Expand Up @@ -347,7 +347,7 @@ functions:
identityValidationExpression: someRegex
```

You can also use the Request Type Authorizer by setting the `type` property. In this case, your `identitySource` could contain multiple entries for you policy cache. The default `type` is 'token'.
You can also use the Request Type Authorizer by setting the `type` property. In this case, your `identitySource` could contain multiple entries for your policy cache. The default `type` is 'token'.

```yml
functions:
Expand Down Expand Up @@ -523,6 +523,7 @@ This method is more complicated and involves a lot more configuration of the `ht
"cognitoPoolClaims": {
"sub": ""
},
"enhancedAuthContext": {},
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
Expand Down Expand Up @@ -857,7 +858,7 @@ Now that you have these two CloudFormation templates defined in your `serverless

## Share API Gateway and API Resources

As you application grows, you will have idea to break it out into multiple services. However, each serverless project generates new API Gateway by default. If you want to share same API Gateway for muliple projects, you 'll need to reference REST API ID and Root Resource ID into serverless.yml files
As your application grows, you will likely need to break it out into multiple, smaller services. By default, each Serverless project generates a new API Gateway. However, you can share the same API Gateway between multiple projects by referencing its REST API ID and Root Resource ID in `serverless.yml` as follows:

```yml
service: service-name
Expand All @@ -872,7 +873,8 @@ functions:

```

In case the application has many chilren and grandchildren paths, you also want to break them out into smaller services.

If your application has many nested paths, you might also want to break them out into smaller services.

```yml
service: service-a
Expand Down Expand Up @@ -906,7 +908,7 @@ functions:
path: /posts/{id}/comments
```

They reference the same parent path `/posts`. Cloudformation will throw error if we try to generate existed one. To avoid that, we must reference source ID of `/posts`.
The above example services both reference the same parent path `/posts`. However, Cloudformation will throw an error if we try to generate an existing path resource. To avoid that, we reference the resource ID of `/posts`:

```yml
service: service-a
Expand Down Expand Up @@ -936,7 +938,8 @@ functions:

```

You can define more than one path resource. Otherwise, serverless will generate paths from root resource. `restApiRootResourceId` can be optional if there isn't path that need to be generated from the root
You can define more than one path resource, but by default, Serverless will generate them from the root resource.
`restApiRootResourceId` is optional if a path resource isn't required for the root (`/`).

```yml
service: service-a
Expand Down Expand Up @@ -966,4 +969,4 @@ functions:

```

For best practice and CI, CD friendly, we should define Cloudformation resources from early service, then use Cross-Stack References for another ones.
To be more in line with best practices and to be CI/CD friendly, we should define CloudFormation resources from an earlier service, then use Cross-Stack References from it in future projects.
21 changes: 21 additions & 0 deletions docs/providers/aws/events/cloudwatch-event.md
Expand Up @@ -111,3 +111,24 @@ functions:
state:
- pending
```

## Specifying a Name

You can also specify a CloudWatch Event name. Keep in mind that the name must begin with a letter; contain only ASCII letters, digits, and hyphens; and not end with a hyphen or contain two consecutive hyphens. More infomation [here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html).

```yml
functions:
myCloudWatch:
handler: myCloudWatch.handler
events:
- cloudwatchEvent:
name: 'my-cloudwatch-event-name'
event:
source:
- "aws.ec2"
detail-type:
- "EC2 Instance State-change Notification"
detail:
state:
- pending
```
2 changes: 1 addition & 1 deletion docs/providers/aws/events/cloudwatch-log.md
Expand Up @@ -14,7 +14,7 @@ layout: Doc

## Simple event definition

This will enable your Lambda function to be called by an Log Stream.
This will enable your Lambda function to be called by a Log Stream.

```yml
functions:
Expand Down
4 changes: 3 additions & 1 deletion docs/providers/aws/examples/hello-world/README.md
Expand Up @@ -17,6 +17,8 @@ Pick your language of choice:

* [JavaScript](./node)
* [Python](./python)
* [csharp](./csharp)
* [C#](./csharp)
* [F#](./fsharp)
* [Go](./go)

[View all examples](https://www.serverless.com/framework/docs/providers/aws/examples/)
42 changes: 35 additions & 7 deletions docs/providers/aws/examples/hello-world/csharp/README.md
Expand Up @@ -13,13 +13,32 @@ layout: Doc

Make sure `serverless` is installed. [See installation guide](../../../guide/installation.md).

Once installed the Serverless CLI can be called with `serverless` or the shorthand `sls` command.

```
$ sls
Commands
* You can run commands with "serverless" or the shortcut "sls"
* Pass "--verbose" to this command to get in-depth plugin info
* Pass "--no-color" to disable CLI colors
* Pass "--help" after any <command> for contextual help
```

## 1. Create a service
`serverless create --template aws-csharp --path myService` or `sls create --template aws-csharp --path myService`, where 'myService' is a new folder to be created with template service files. Change directories into this new folder.

```
sls create --template aws-csharp --path myService
```

Using the `create` command we can specify one of the available [templates](https://serverless.com/framework/docs/providers/aws/cli-reference/create#available-templates). For this example use aws-csharp with the `--template` or shorthand `-t` flag.

The `--path` or shorthand `-p` is the location to be created with the template service files. Change directories into this new folder.

## 2. Build using .NET CLI tools and create zip package

```
# Linux or OSX
# Linux or Mac OS
./build.sh
```

Expand All @@ -29,14 +48,23 @@ Make sure `serverless` is installed. [See installation guide](../../../guide/ins
```

## 3. Deploy
`serverless deploy` or `sls deploy`. `sls` is shorthand for the Serverless CLI command

```
sls deploy
```

This will deploy your function to AWS Lambda based on the settings in `serverless.yml`.


## 4. Invoke deployed function
`serverless invoke --function hello` or `serverless invoke -f hello`

`-f` is shorthand for `--function`
```
sls invoke -f hello
```

Invoke deployed function with command `invoke` and `--function` or shorthand `-f`.

In your terminal window you should see the response from AWS Lambda
In your terminal window you should see the response from AWS Lambda.

```bash
{
Expand All @@ -49,4 +77,4 @@ In your terminal window you should see the response from AWS Lambda
}
```

Congrats you have just deployed and run your Hello World function!
Congrats you have deployed and ran your Hello World function!
17 changes: 0 additions & 17 deletions docs/providers/aws/examples/hello-world/fsharp/Handler.fs

This file was deleted.

0 comments on commit 6192e0b

Please sign in to comment.