Skip to content

Commit 31b525f

Browse files
authored
Merge pull request #5 from mitre/readme_recommendation
Update README.md
2 parents 6847ab0 + 072abf2 commit 31b525f

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
This code uses the Serverless Framework to deploy an AWS lambda function that, when triggered at a certain rate, will run the [SAF CLI](https://github.com/mitre/saf) with the given input command (`COMMAND_STRING`) and can optionally upload results to an S3 bucket. This example is specifically relevant to running the command `convert ionchannel2hdf`.
33

44
## Getting Started
5-
1. Clone this repository: `git clone https://github.com/mitre/saf-lambda-function.git`
6-
2. Install the Serverless Framework: `npm install -g serverless`
5+
(This is installed and kept up to date using `npm`, which is included with most versions of [NodeJS](https://nodejs.org/en/).)
6+
1. Clone this repository: `git clone https://github.com/mitre/saf-lambda-function.git -b ionChannel`
7+
2. cd saf-lambda-function
78
3. Install the latest dependencies: `npm install`
8-
4. Configure your AWS credentials. [Recommended method](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) is to add a profile in the `~/.aws/credentials` file and then export that profile:
9+
4. Install the Serverless Framework: `npm install -g serverless`
10+
5. Configure your AWS credentials. [Recommended method](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) is to add a profile in the `~/.aws/credentials` file and then export that profile:
911
```bash
1012
export AWS_PROFILE=<your_creds_profile_name>
1113

@@ -20,14 +22,14 @@ Additional optional variables can be set to further configure the function. The
2022

2123
| ENVIRONMENT NAME | Required | Default | Examples |
2224
| --- | --- | --- | --- |
23-
| **COMMAND_STRING** | x | none | "convert hdf2splunk -H 127.0.0.1 -u admin -p Valid_password! -I hdf", "convert burpsuite2hdf", See more [here](https://github.com/mitre/saf#usage) |
24-
| **OUTPUT_BUCKET** | x | none | "other-bucket-name" |
25+
| **COMMAND_STRING** | x | none | "convert ionchannel2hdf -a api-key -t your-team-name", See more [here](https://github.com/mitre/saf#usage) |
26+
| **OUTPUT_BUCKET** | x | none | "bucket-name" |
2527
| OUTPUT_ENABLED | | true | false |
2628
| OUTPUT_PREFIX | | "results/" | "output/", "results/hdf/", "" |
2729
| OUTPUT_TIMEOUT | | 60 | lambda timeout value in seconds |
2830
| SERVICE_NAME | | "saf-lambda-function" | "different-service-name" |
2931

30-
5. Set the required variables: `OUTPUT_BUCKET` and `COMMAND_STRING`.
32+
6. Set the required variables: `OUTPUT_BUCKET` and `COMMAND_STRING`.
3133
- Example:
3234
```bash
3335
export OUTPUT_BUCKET="bucket-name"
@@ -38,18 +40,21 @@ export COMMAND_STRING="convert ionchannel2hdf -a api-key -t your-team-name"
3840
- NOTE: This action does not support `view heimdall`.
3941
- More examples can be found at [SAF CLI Usage](https://github.com/mitre/saf#usage)
4042
- You can ensure that the environment variables are set properly: `env`.
41-
6. Set any optional variables that you may want to change. If the default value for any of these variables suffices, it does not need to be set.
43+
7. Set any optional variables that you may want to change. If the default value for any of these variables suffices, it does not need to be set.
4244

4345
## Test and Deploy your SAF CLI Lambda function
4446

47+
### Test by invoking locally
48+
8. Run `serverless invoke local --function saf` to invoke the function locally. This will interact with your real OUTPUT_BUCKET. You can check the AWS Console for the results files.
49+
4550
### Deploy the service
46-
7. `serverless deploy --verbose`. This may take several minutes.
51+
9. `serverless deploy --verbose`. This may take several minutes.
4752

4853
### Test by invoking via AWS
49-
8. When the service is deployed successfully, log into the AWS console, go to the "Lamda" interface, and check the logs under the "monitor" tab to see if the function ran at the desired time.
54+
10. When the service is deployed successfully, log into the AWS console, go to the "Lamda" interface, and check the logs under the "monitor" tab to see if the function ran at the desired time.
5055
![Screenshot 2022-04-20 at 09-30-41 Functions - Lambda](https://user-images.githubusercontent.com/32680215/164255328-782346f3-689f-458d-8ebe-b3f9af67964a.png)
5156

52-
9. Check the output in your `OUTPUT_BUCKET`.![Screenshot 2022-04-20 at 09-32-39 sls-attempt-three-emcrod - S3 bucket](https://user-images.githubusercontent.com/32680215/164255397-a6b68b51-31da-4228-83eb-bcd5928f315e.png)
57+
11. Check the output in your `OUTPUT_BUCKET`.![Screenshot 2022-04-20 at 09-32-39 sls-attempt-three-emcrod - S3 bucket](https://user-images.githubusercontent.com/32680215/164255397-a6b68b51-31da-4228-83eb-bcd5928f315e.png)
5358

5459

5560
### Contributing

0 commit comments

Comments
 (0)