Skip to content

Commit 687d94c

Browse files
GromNaNalcaeusjmikola
authored
Apply suggestions from code review
Co-authored-by: Andreas Braun <[email protected]> Co-authored-by: Jeremy Mikola <[email protected]>
1 parent 679b311 commit 687d94c

File tree

3 files changed

+12
-22
lines changed

3 files changed

+12
-22
lines changed

docs/examples/lambda-aws/index.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@
66

77
$uri = getenv('MONGODB_URI') ?: throw new RuntimeException('The MONGODB_URI environment variable is not set');
88
$client = new Client($uri);
9-
$planets = $client
10-
->selectDatabase('sample_guides')
11-
->selectCollection('planets')
9+
$planets = $client->sample_guides->planets
1210
->find(
1311
[],
14-
[
15-
'sort' => ['orderFromSun' => 1],
16-
'typeMap' => ['root' => 'array'],
17-
],
12+
['sort' => ['orderFromSun' => 1]],
1813
);
1914

2015
?>
@@ -26,7 +21,7 @@
2621
<body>
2722
<ul>
2823
<?php foreach ($planets as $planet) : ?>
29-
<li><?= $planet['name'] ?></li>
24+
<li><?= $planet->name ?></li>
3025
<?php endforeach ?>
3126
</ul>
3227
</body>

docs/examples/lambda-aws/serverless.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,3 @@ functions:
2121
layers:
2222
- ${bref-extra:mongodb-php-83}
2323

24-
# Exclude files from deployment
25-
package:
26-
patterns:
27-
- '!node_modules/**'
28-
- '!tests/**'

docs/tutorial/lambda-aws.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
============================================
2-
Deploy to Serverless AWS Lambda with BrefPHP
2+
Deploy to AWS Lambda with Bref
33
============================================
44

55
.. default-domain:: mongodb
@@ -19,21 +19,21 @@ Overview
1919
In this tutorial, you will deploy a simple PHP application with the MongoDB PHP extension,
2020
and connect to an Atlas cluster using AWS IAM authentication.
2121

22-
Pre-requisites
22+
Prerequisites
2323
--------------
2424

25-
Before you begin, you must install bref on your machine. You can follow the
25+
Before you begin, you must install Bref on your machine. You can follow the
2626
`official documentation to setup bref <https://bref.sh/docs/setup>`_.
2727

28-
Install the mongodb extension
28+
Install the MongoDB extension
2929
-----------------------------
3030

3131
By default, the bref layer is compiled with PHP and a few extensions. Additional extensions
3232
are provided in additional layers.
3333

3434
Start by creating a new directory for your project and install the required mongodb
3535
and bref dependencies. This project will be a bare minimum PHP web application that
36-
connects to a MongoDB cluster, no framework is used, but you can adapt the code to
36+
connects to a MongoDB cluster. No framework is used, but you can adapt the code to
3737
your needs.
3838

3939
.. code-block:: bash
@@ -43,7 +43,7 @@ your needs.
4343
vendor/bin/bref init
4444

4545

46-
A very simple web page have been created. To validate the deployment, you can start
46+
The file ``index.php`` has been created. To validate the deployment, you can start
4747
by deploying this default application.
4848

4949
.. code-block:: bash
@@ -89,9 +89,9 @@ Atlas supports passwordless authentication with AWS credentials. In any Lambda f
8989
AWS sets environment variables that contains the access token and secret token with
9090
the role assigned to deployed function.
9191

92-
Set Up `unified AWS Access <https://www.mongodb.com/docs/atlas/security/set-up-unified-aws-access/>`
92+
Set up `unified AWS Access <https://www.mongodb.com/docs/atlas/security/set-up-unified-aws-access/>`
9393

94-
1. Open the lambda function in the AWS console
94+
1. Open the Lambda function in the AWS console
9595
2. In "Configuration > Permission", copy the "Role name"
9696
3. Open the MongoDB Atlas project
9797
4. Go to "Security > Database Access"
@@ -109,7 +109,7 @@ Update the ``serverless.yml`` file to pass the environment variable ``MONGODB_UR
109109

110110
provider:
111111
environment:
112-
MONGODB_URI: "mongodb+srv://cluster0.abcdefg.mongodb.net/"
112+
MONGODB_URI: "mongodb+srv://cluster0.example.mongodb.net/"
113113

114114

115115
The value can be found in "Atlas > Deployment > Database > Connect". Select "3. AWS IAM".

0 commit comments

Comments
 (0)