Skip to content

Commit fb00091

Browse files
committed
More ready
1 parent b8c5576 commit fb00091

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

README.rst

+22-14
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,40 @@ docs
1414
<http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example-create-iam-role.html>`_
1515
(of course you need one that can execute lambdas).
1616

17-
In a new folder, create *mymodule.py*:
17+
In a new folder, create *mymodule.py*.
1818

1919
.. code:: python
2020
2121
def hello(*args):
2222
return "Hello, world!"
2323
2424
25-
Then deploy the function (fill in your execution role resource name from the AWS
26-
console):
25+
Then deploy the function (fill in your execution role resource name from the
26+
AWS console).
2727

2828
::
2929

3030
awslambda . mybucket --create hello mymodule.hello arn:aws:iam::xxxxxxxxxxxx:role/myrole
3131

3232

33+
When *awslambda* is done, you can test your new function in the Lambda
34+
management console.
35+
3336
From now on, if you make changes to the function, just run:
3437

3538
::
3639

3740
awslambda . mybucket --update hello
3841

3942

40-
You can use as many options as you like (shown here with shorthand names):
43+
You can use as many options as you like (some shown here with short names).
4144

4245
::
4346

4447
awslambda . mybucket -u hello -u myotherlambda --delete myoldlambda
4548

4649

47-
Or specify your functions in a YAML file (lets call it *sync.yaml*):
50+
Or specify your functions in a YAML file (let's call it *sync.yaml*).
4851

4952
.. code:: yaml
5053
@@ -55,28 +58,33 @@ Or specify your functions in a YAML file (lets call it *sync.yaml*):
5558
# handler: myothermodule.myotherhandler
5659
# role: arn:aws:iam::xxxxxxxxxxxx:role/myrole
5760
58-
Syncing from a file, *awslambda* will update existing functions and create the
59-
others automatically.
61+
When syncing from a file, *awslambda* will update existing functions and create
62+
the others automatically.
6063

6164
::
6265

6366
awslambda . mybucket --sync sync.yaml
6467

6568

66-
To add dependencies, use your `pip *requirements.txt*
67-
<https://pip.readthedocs.io/en/stable/user_guide/#requirements-files>`_:
69+
To add dependencies, use your `pip requirements file
70+
<https://pip.readthedocs.io/en/stable/user_guide/#requirements-files>`_.
6871

6972
::
7073

7174
awslambda . mybucket -s sync.yaml --requirements requirements.txt
7275

7376

77+
*Note that compiled dependencies* awslambda *downloads on your local machine
78+
might not work on the AWS servers. Pure Python libraries should always work.
79+
For others, it could be helpful to run* awslambda *itself in a Lambda function.
80+
A process knows as* awslambdaception.
81+
7482
A template greeting page
7583
........................
7684

7785
Let's use the features introduced above to create a greeting page. We will use
7886
the `Jinja2<http://jinja.pocoo.org>`_ templating engine.
79-
Edit *mymodule.py*
87+
Edit *mymodule.py*,
8088

8189
.. code:: python
8290
@@ -99,21 +107,21 @@ Edit *mymodule.py*
99107
'body': template.render(parameters=event['queryStringParameters'])}
100108
101109
102-
And create your simple *requirements.txt*
110+
and create a simple *requirements.txt*.
103111

104112
::
105113

106114
Jinja2
107115

108116

109-
Deploy
117+
Deploy,
110118

111119
::
112120

113121
awslambda . mybucket -s sync.yaml -r requirements.txt
114122

115123

116-
Open the function in your AWS console. Go to *Triggers* and add an
124+
then open the function in your AWS console. Go to *Triggers* and add an
117125
*API Gateway* trigger. Set security to *Open* for now. Open the URL of the
118126
created trigger in your browser. You should see "Hello, !". To customize the
119127
page append e.g.
@@ -123,7 +131,7 @@ page append e.g.
123131
?name=Commander Shepard&message=You've received a new message at your private terminal.
124132

125133

126-
to the URL.
134+
to the URL and enjoy your serverless, templated webpage!
127135

128136

129137
Usage

0 commit comments

Comments
 (0)