You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-10Lines changed: 15 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,12 @@
2
2
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`.
3
3
4
4
## 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
7
8
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:
9
11
```bash
10
12
export AWS_PROFILE=<your_creds_profile_name>
11
13
@@ -20,14 +22,14 @@ Additional optional variables can be set to further configure the function. The
20
22
21
23
| ENVIRONMENT NAME | Required | Default | Examples |
22
24
| --- | --- | --- | --- |
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)|
- NOTE: This action does not support `view heimdall`.
39
41
- More examples can be found at [SAF CLI Usage](https://github.com/mitre/saf#usage)
40
42
- 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.
42
44
43
45
## Test and Deploy your SAF CLI Lambda function
44
46
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
+
45
50
### Deploy the service
46
-
7.`serverless deploy --verbose`. This may take several minutes.
51
+
9.`serverless deploy --verbose`. This may take several minutes.
47
52
48
53
### 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.
50
55

51
56
52
-
9. Check the output in your `OUTPUT_BUCKET`.
57
+
11. Check the output in your `OUTPUT_BUCKET`.
0 commit comments