<commit_before># aws-serverless-samfarm
This repo contains the full code and templates needed to create a the Serverless SamFarm demo as shown in the What's New with AWS Lambda presentation at Re:Invent 2016.

There are three separate parts to this application: the api, the pipeline which detects, builds, and deploys changes, and the website. 
Lets start by getting that website up and running.

## Step 1

### Website
In the [website directory](website/) there are four files:

1. **[index.html](website/index.html):** This is the index file that our S3 bucket will be displaying.
2. **[app.js](website/app.js):** The heart of our website. We will be making some changes to this in a bit, but for now we can leave it alone.
3. **[squirrel.png](website/squirrel.png):** Our friend! SAM the squirrel.
4. **[website.yaml](website/website.yaml):** The CloudFormation template used to create the Amazon S3 bucket for the website.

To create the website stack.

[<img src="https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png">](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=myteststack&templateURL=https://awscomputeblogimages.s3-us-west-2.amazonaws.com/samfarm-website.yaml)

Once the stack is complete, we will need to keep track of the S3 bucket name and the URL for the website. 

Now we have all the seperate parts of our website, but lets get SAM up and running:

```bash
sh upload_website.sh <s3-bucket-name>
```

And visit the url you saved before. You should see something like this:

![](https://tinybits.awsbryan.com/0l1Qd3oMc8.gif)

Ta-da, a working website! SAM the squirrel may be all alone right now, but we'll fix that in a bit.


## Step 2
### API
The Serverless API we are building! The [api directory](api/) contains five files. 

1. **[beta.json](api/beta.json):** The CloudFormation staging file. This will be used by CloudFormation to pass parameters to our CloudFormation template.
2. **[buildspec.yml](api/buildspec.yml):** This is used by CodeBuild in the build step of our pipeline. We will get to that later.
3. **[index.js](api/index.js):** The Lambda function code!
4. **[package.json](api/package.json):** The package.json that defines what packages we need for our Lambda function.
5. **[saml.yaml](api/saml.yaml):** SAML my YAML! This is the SAM template file that will be used to create our API gateway resource and Lambda function, hook them up together

Create a new github repo from the [api directory](api/) and place these files in there. This repo will be used for your automated CI/CD pipeline we build below.
<commit_msg>fixing broken screenshot in README<commit_after># aws-serverless-samfarm
This repo contains the full code and templates needed to create a the Serverless SamFarm demo as shown in the What's New with AWS Lambda presentation at Re:Invent 2016.

There are three separate parts to this application: the api, the pipeline which detects, builds, and deploys changes, and the website. 
Lets start by getting that website up and running.

## Step 1

### Website
In the [website directory](website/) there are four files:

1. **[index.html](website/index.html):** This is the index file that our S3 bucket will be displaying.
2. **[app.js](website/app.js):** The heart of our website. We will be making some changes to this in a bit, but for now we can leave it alone.
3. **[squirrel.png](website/squirrel.png):** Our friend! SAM the squirrel.
4. **[website.yaml](website/website.yaml):** The CloudFormation template used to create the Amazon S3 bucket for the website.

To create the website stack.

[<img src="https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png">](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=myteststack&templateURL=https://awscomputeblogimages.s3-us-west-2.amazonaws.com/samfarm-website.yaml)

Once the stack is complete, we will need to keep track of the S3 bucket name and the URL for the website. 

Now we have all the seperate parts of our website, but lets get SAM up and running:

```bash
sh upload_website.sh <s3-bucket-name>
```

And visit the url you saved before. You should see something like this:

![SAM Screenshot](/img/sam-screenshot.png)

Ta-da, a working website! SAM the squirrel may be all alone right now, but we'll fix that in a bit.


## Step 2
### API
The Serverless API we are building! The [api directory](api/) contains five files. 

1. **[beta.json](api/beta.json):** The CloudFormation staging file. This will be used by CloudFormation to pass parameters to our CloudFormation template.
2. **[buildspec.yml](api/buildspec.yml):** This is used by CodeBuild in the build step of our pipeline. We will get to that later.
3. **[index.js](api/index.js):** The Lambda function code!
4. **[package.json](api/package.json):** The package.json that defines what packages we need for our Lambda function.
5. **[saml.yaml](api/saml.yaml):** SAML my YAML! This is the SAM template file that will be used to create our API gateway resource and Lambda function, hook them up together

Create a new github repo from the [api directory](api/) and place these files in there. This repo will be used for your automated CI/CD pipeline we build below.

{'fraction_non_alphanumeric': 0.10060629026146267, 'fraction_numerical': 0.009473285335354301, 'mean_word_length': 4.510438413361169, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4833697', 'n_tokens_mistral': 1609, 'n_tokens_neox': 1503, 'n_words': 701}