forked from newrelic/aws_s3_log_ingestion_lambda
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from framer/wip/merge-and-improve
Merge upstream improvements
- Loading branch information
Showing
10 changed files
with
424 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,6 @@ packaged.yml | |
# SAM | ||
.aws-sam/ | ||
#VS Code | ||
.vscode/ | ||
.vscode/ | ||
#JetBrains | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Developer | ||
|
||
This project uses [SAM](https://aws.amazon.com/serverless/sam/) tool for build, | ||
run locally, package and publish. | ||
|
||
There is a serverless file to play locally as well, but here we will focus on | ||
the [SAM](https://aws.amazon.com/serverless/sam/) way of doing it. | ||
|
||
## Requirements | ||
|
||
- Make | ||
|
||
### Local run / build | ||
|
||
- Docker | ||
- AWS Account | ||
- AWS Profile configured on your computer, remember that AWS uses the `default` | ||
profile unless you specify it. You can specify usign `AWS_PROFILE` enviroment | ||
variable. | ||
- [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-reference.html#serverless-sam-cli) | ||
|
||
### Package | ||
|
||
- An AWS S3 bucket where the package will be uploaded | ||
|
||
### Deploy | ||
|
||
- AWS Account and enough permissions to do the deploy, generated template will | ||
need IAM capabilities. | ||
|
||
### Publishing | ||
|
||
- For personal publishing is mandatory to update the function name on the | ||
`template.yml` file to avoid collide with the New Relic official release of | ||
this application. | ||
|
||
## Building it locally | ||
|
||
This will generate an image of the lambda application using a docker container | ||
that you will be able to run locally. | ||
|
||
Just run `make build`. | ||
|
||
## Running locally | ||
|
||
You should have built the image locally as mentioned in the previous step. | ||
|
||
Then you need to have a "sample" event of a file in an S3 bucket so we can use | ||
it, we provide a sample one in the test/mock.json but it wouldn't work if you | ||
haven't access to the given S3 bucket. | ||
|
||
Then just run `LICENSE_KEY=<YOUR_NEW_RELIC_LICENSE_KEY> TEST_FILE="./test/mock.json" make run` to run it locally. | ||
|
||
## Packaging | ||
|
||
Run `BUCKET=<S3_BUCKET_NAME> REGION=<S3_BUCKET_AWS_REGION> make package` | ||
|
||
## Deploying | ||
|
||
Run `REGION=<THE_REGION_YOU_WANT> STACK_NAME=<THE_STACK_NAME_YOU_WANT> make deploy` | ||
|
||
## Publishing | ||
|
||
Run `REGION=<SAR_AWS_REGION> make publish` to publish your package. Remember to | ||
update the function name before publishing it to do not collide with the New | ||
Relic official application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
build: | ||
sam build --use-container | ||
|
||
run: check-run-env | ||
sam local invoke "NewRelicLogIngestionFunction" -e $(TEST_FILE) | ||
|
||
package: check-package-env | ||
sam package --output-template-file packaged.yml --s3-bucket $(BUCKET) --region $(REGION) | ||
|
||
deploy: check-deploy-env | ||
sam deploy --template-file packaged.yml --stack-name $(STACK_NAME) --region $(REGION) | ||
|
||
publish: check-publish-env | ||
sam publish --template packaged.yml --region $(REGION) | ||
|
||
check-run-env: | ||
ifndef LICENSE_KEY | ||
$(error LICENSE_KEY is undefined) | ||
endif | ||
ifndef TEST_FILE | ||
$(error TEST_FILE is undefined) | ||
endif | ||
|
||
check-package-env: | ||
ifndef REGION | ||
$(error REGION is undefined) | ||
endif | ||
ifndef BUCKET | ||
$(error BUCKET is undefined) | ||
endif | ||
|
||
check-deploy-env: | ||
ifndef REGION | ||
$(error REGION is undefined) | ||
endif | ||
ifndef STACK_NAME | ||
$(error STACK_NAME is undefined) | ||
endif | ||
|
||
check-publish-env: | ||
ifndef REGION | ||
$(error REGION is undefined) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[![Community Project header](https://github.com/newrelic/open-source-office/raw/master/examples/categories/images/Community_Project.png)](https://github.com/newrelic/open-source-office/blob/master/examples/categories/index.md#community-project) | ||
[![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus) | ||
|
||
# AWS Lambda for sending logs from S3 to New Relic | ||
|
||
|
@@ -22,5 +22,11 @@ Contributions to improve s3-log-ingestion-lambda are encouraged! Keep in mind wh | |
|
||
To execute our corporate CLA, which is required if your contribution is on behalf of a company, or if you have any questions, please drop us an email at [email protected]. | ||
|
||
## Developers | ||
|
||
For more information about how to contribute from the developer point of view, | ||
we recommend you to take a look to the [DEVELOPER.md](./DEVELOPER.md) that | ||
contains most of the info you'll need. | ||
|
||
## License | ||
`s3-log-ingestion-lambda` is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License. The s3-log-ingestion-lambda also uses source code from third party libraries. Full details on which libraries are used and the terms under which they are licensed can be found in the third party notices docume | ||
`s3-log-ingestion-lambda` is licensed under the [Apache 2.0](http://apache.org/licenses/LICENSE-2.0.txt) License. The s3-log-ingestion-lambda also uses source code from third party libraries. Full details on which libraries are used and the terms under which they are licensed can be found in the third party notices document |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.