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: apigw-rest-api-lambda-python/README.md
+15-16Lines changed: 15 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ The AWS Toolkit is an open source plug-in for popular IDEs that uses the AWS SAM
25
25
26
26
## Deploy the sample application
27
27
28
-
The Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.
28
+
The AWS Serverless Application Model Command Line Interface (AWS SAM CLI) is a framework for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. It can also emulate your application's build environment and API.
29
29
30
30
To use the AWS SAM CLI, you need the following tools.
31
31
@@ -38,9 +38,9 @@ To use the AWS SAM CLI, you need the following tools.
38
38
To build and deploy your application for the first time, run the following in your shell:
39
39
40
40
```bash
41
-
$ cd apigw-rest-api-lambda-python
42
-
$ sam build --use-container
43
-
$ sam deploy --guided
41
+
cd apigw-rest-api-lambda-python
42
+
sam build --use-container
43
+
sam deploy --guided
44
44
```
45
45
46
46
The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts:
@@ -54,26 +54,26 @@ The first command will build the source of your application. The second command
54
54
55
55
You can find your API Gateway Endpoint URL in the output values displayed after deployment.
56
56
57
-
## Use the AWS SAM CLI to test locally
57
+
## Use AWS SAM CLI to test locally
58
58
59
-
The SAM CLI installs dependencies defined in `hello_world/package.json`, creates a deployment package, and saves it in the `.aws-sam/build` folder.
59
+
The AWS SAM CLI installs dependencies defined in `hello_world/package.json`, creates a deployment package, and saves it in the `.aws-sam/build` folder.
60
60
61
-
Ypu can test a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the `events` folder in this project.
61
+
You can test a single function by invoking it directly with a test event. An event is a JSON document that represents the input that the function receives from the event source. Test events are included in the `events` folder in this project.
62
62
63
63
Run functions locally and invoke them with the `sam local invoke` command.
64
64
65
65
```bash
66
-
$ sam local invoke HelloWorldFunction --event events/event.json
66
+
sam local invoke HelloWorldFunction --event events/event.json
67
67
```
68
68
69
-
The AWS SAM CLI can also emulate your application's API. Use the `sam local start-api` to run the API locally on port 3000.
69
+
AWS SAM CLI can also emulate your application's API. Use the `sam local start-api` to run the API locally on port 3000.
70
70
71
71
```bash
72
-
$ sam local start-api
73
-
$ curl http://localhost:3000/
72
+
sam local start-api
73
+
curl http://localhost:3000/
74
74
```
75
75
76
-
The AWS SAM CLI reads the application template to determine the API's routes and the functions they invoke. The `Events` property on each function's definition includes the route and method for each path.
76
+
AWS SAM CLI reads the application template to determine the API's routes and the functions they invoke. The `Events` property on each function's definition includes the route and method for each path.
77
77
78
78
```yaml
79
79
Events:
@@ -84,13 +84,13 @@ The AWS SAM CLI reads the application template to determine the API's routes and
84
84
Method: get
85
85
```
86
86
87
-
## Use the AWS SAM CLI to test remotely
87
+
## Use AWS SAM CLI to test remotely
88
88
After you have deployed your application, you can remotely invoke your Lambda function to test it in the cloud.
89
89
90
90
Invoke functions remotely with the `sam remote invoke` command.
91
91
92
92
```bash
93
-
$ sam remote invoke HelloWorldFunction --event-file events/event.json
93
+
sam remote invoke HelloWorldFunction --event-file events/event.json
94
94
```
95
95
96
96
You can also go to the API Gateway endpoint URL that was output after the deployment of your application, which will similarly invoke your deployed Lambda function.
You can find more information and examples about filtering Lambda function logs in the [AWS SAM CLI Documentation](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-logging.html).
108
108
109
-
110
109
## Cleanup
111
110
112
111
To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following:
@@ -117,4 +116,4 @@ $ sam delete
117
116
118
117
## Resources
119
118
120
-
See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for an introduction to SAM specification, the SAM CLI, and serverless application concepts.
119
+
See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for an introduction to AWS SAM specification, the AWS SAM CLI, and serverless application concepts.
0 commit comments