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: aws_lambda_api/README.md
+38-34Lines changed: 38 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,12 @@
3
3
This module creates a Lambda function, and makes it available via a custom domain, complete with SSL termination: e.g. `https://api.example.com/`. This includes:
4
4
5
5
- DNS records on [Route 53](https://aws.amazon.com/route53/)
6
-
- A [CloudFront](https://aws.amazon.com/cloudfront/) distribution for SSL termination
7
-
- An SSL certificate for the distribution from [ACM](https://aws.amazon.com/certificate-manager/)
8
-
- A [Lambda](https://aws.amazon.com/lambda/) function built from your JavaScript code
6
+
- An SSL certificate for the domain from [ACM](https://aws.amazon.com/certificate-manager/)
9
7
-[API Gateway](https://aws.amazon.com/api-gateway/) configuration for invoking the function over HTTP
8
+
- A [Lambda](https://aws.amazon.com/lambda/) function built from your JavaScript code
10
9
11
10
## Example 1: Simple API
12
11
13
-
**Important:** CloudFront operations are generally very slow. Your `terraform apply` may take anywhere **from 10 minutes up to 45 minutes** to complete.
14
-
15
12
First, write down some simple code to deploy in a file called `index.js`:
Assuming you have the [AWS provider](https://www.terraform.io/docs/providers/aws/index.html) set up, and a DNS zone for `example.com` configured on Route 53:
32
29
33
30
```tf
34
-
# Several AWS services (such as ACM & Lambda@Edge) are presently only available in the US East region.
35
-
# To be able to use them, we need a separate AWS provider for that region, which can be used with an alias.
36
-
# Make sure you customize this block to match your regular AWS provider configuration.
# Lambda functions can only be uploaded as ZIP files, so we need to package our JS file into one
44
32
data "archive_file" "lambda_zip" {
45
33
type = "zip"
@@ -62,7 +50,7 @@ module "my_api" {
62
50
}
63
51
```
64
52
65
-
After `terraform apply` (which may take a **very** long time), you should be able to visit `https://api.example.com/`, and be greeted by the above `Hello World!` message.
53
+
After `terraform apply`, you should be able to visit `https://api.example.com/`, and be greeted by the above `Hello World!` message.
66
54
67
55
Because we included the `lambda_logging_enabled` option, you can also log into CloudWatch and check out the properties Lambda makes available in the `event` and `context` properties.
68
56
@@ -83,15 +71,6 @@ Importantly, the most recent compiled version of the Lambda function should alwa
83
71
Assuming you have the [AWS provider](https://www.terraform.io/docs/providers/aws/index.html) set up, and a DNS zone for `example.com` configured on Route 53:
84
72
85
73
```tf
86
-
# Several AWS services (such as ACM & Lambda@Edge) are presently only available in the US East region.
87
-
# To be able to use them, we need a separate AWS provider for that region, which can be used with an alias.
88
-
# Make sure you customize this block to match your regular AWS provider configuration.
0 commit comments