<commit_before># public-bikes

public-bikes is a sample project that utilizes the [AWS Serverless Application Model (SAM)](https://aws.amazon.com/about-aws/whats-new/2016/11/introducing-the-aws-serverless-application-model/) in conjunction with Amazon ElastiCache to find nearby public bike stations.

For more details on this project, please visit the accompanying blog post at XXX.

## Getting Started

To get started, clone this repository locally:

```
$ git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/public-bikes
```

The repostiory contains [CloudFormation](https://aws.amazon.com/cloudformation/) templates and source code to deploy and run a complete sample application.


### Prerequisites

To run the public-bikes sample application, you will need to:

1. Select an AWS Region into which you will deploy services. Be sure that all required services (AWS Lambda, Amazon API Gateway, Amazon ElastiCache, Amazon DynamoDB) are available in the Region you select.
2. Confirm your [installation](http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-bundle-other-os) of the AWS CLI is properly [configured](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-quick-configuration) with credentials that have administrator access to your AWS account.

Locally, you will also need Node.js installed with NPM.  After cloing the repository, execute the following commands to install dependencies:

```
$ cd <CLONE_DIRECTORY>
$ cd api && npm install
$ cd ../stream && npm install
$ cd ..
```

## Deploy AWS Resources

The deployment of our AWS resources has been broken into two CloudFormation templates.  The first of which contains network resources, including VPC, Subnets, and Gateways.  While not strictly necessary in this example, utilizing VPC is intended to help secure our deployment.

1. Deploy the network stack (network.yaml) via the AWS CLI:
    ```
    $ aws cloudformation deploy --template <CLONE_DIRECTORY>/network.yaml --stack-name public-bikes-network
    ```
2. Once stack creation is complete, we need to retreive the values of two of the outputs from the network stack, `oPrivateSubnet1` and `oFunctionSecurityGroup`.
3. Copy or rename the example SAM template (`app-sam.example.yaml`) to `app-sam.yaml`.
4. Open `app-sam.yaml` in your favorite text editor and replace all instances of (note: future versions of this sample will not require this manual find/replace):
    * `<SECURITY_GROUP>` with value of `oFunctionSecurityGroup`
    * `<SUBNET>` with value of `oPrivateSubnet1`
5. Create a new S3 bucket from which to deploy our source code:<commit_msg>Update path for setup instructions<commit_after># public-bikes

public-bikes is a sample project that utilizes the [AWS Serverless Application Model (SAM)](https://aws.amazon.com/about-aws/whats-new/2016/11/introducing-the-aws-serverless-application-model/) in conjunction with Amazon ElastiCache to find nearby public bike stations.

For more details on this project, please visit the accompanying blog post at XXX.

## Getting Started

To get started, clone this repository locally:

```
$ git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/public-bikes
```

The repostiory contains [CloudFormation](https://aws.amazon.com/cloudformation/) templates and source code to deploy and run a complete sample application.


### Prerequisites

To run the public-bikes sample application, you will need to:

1. Select an AWS Region into which you will deploy services. Be sure that all required services (AWS Lambda, Amazon API Gateway, Amazon ElastiCache, Amazon DynamoDB) are available in the Region you select.
2. Confirm your [installation](http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-bundle-other-os) of the AWS CLI is properly [configured](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-quick-configuration) with credentials that have administrator access to your AWS account.

Locally, you will also need Node.js installed with NPM.  After cloing the repository, execute the following commands to install dependencies:

```
$ cd <CLONE_DIRECTORY>/server
$ cd api && npm install
$ cd ../stream && npm install
$ cd ..
```

## Deploy AWS Resources

The deployment of our AWS resources has been broken into two CloudFormation templates.  The first of which contains network resources, including VPC, Subnets, and Gateways.  While not strictly necessary in this example, utilizing VPC is intended to help secure our deployment.

1. Deploy the network stack (network.yaml) via the AWS CLI:
    ```
    $ aws cloudformation deploy --template <CLONE_DIRECTORY>/network.yaml --stack-name public-bikes-network
    ```
2. Once stack creation is complete, we need to retreive the values of two of the outputs from the network stack, `oPrivateSubnet1` and `oFunctionSecurityGroup`.
3. Copy or rename the example SAM template (`app-sam.example.yaml`) to `app-sam.yaml`.
4. Open `app-sam.yaml` in your favorite text editor and replace all instances of (note: future versions of this sample will not require this manual find/replace):
    * `<SECURITY_GROUP>` with value of `oFunctionSecurityGroup`
    * `<SUBNET>` with value of `oPrivateSubnet1`
5. Create a new S3 bucket from which to deploy our source code:
{'fraction_non_alphanumeric': 0.0866867243324558, 'fraction_numerical': 0.006769462203836028, 'mean_word_length': 4.5754716981132075, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, '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': '6129586', 'n_tokens_mistral': 1486, 'n_tokens_neox': 1423, 'n_words': 619}