Skip to content

Commit c1d8688

Browse files
committed
initial commit
1 parent 956e029 commit c1d8688

File tree

1 file changed

+11
-88
lines changed

1 file changed

+11
-88
lines changed
Lines changed: 11 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,5 @@
11
# Complete Lambda Example - All Features Showcase
22

3-
This is the **ultimate example** that demonstrates **ALL features** of the AWS Lambda Terraform module in a single, comprehensive deployment. This example showcases every capability including VPC integration, database connectivity, dead letter queues, versioning, aliases, provisioned concurrency, multiple event sources, KMS encryption, and advanced monitoring.
4-
5-
## 🚀 What This Example Creates
6-
7-
### **Core Infrastructure**
8-
-**RDS PostgreSQL Database** with encryption and security groups
9-
-**KMS Key** for environment variable encryption
10-
11-
### **Lambda Function Features**
12-
-**ARM64 Architecture** for better price-performance
13-
-**VPC Integration** with private subnet deployment
14-
-**Dead Letter Queue** with SQS for error handling
15-
-**Versioning & Aliases** for blue-green deployments
16-
-**Provisioned Concurrency** to eliminate cold starts
17-
-**KMS Encryption** for environment variables
18-
-**Lambda Insights** for advanced monitoring
19-
-**Function URL** with CORS configuration
20-
21-
### **Event Sources & Integrations**
22-
-**S3 Bucket** with object event notifications
23-
-**SNS Topic** with Lambda subscription
24-
-**SQS Queue** with event source mapping
25-
-**API Gateway** with Lambda proxy integration
26-
-**EventBridge** with scheduled invocations
27-
-**SSM Parameter Store** with 10+ parameters
28-
29-
### **Monitoring & Observability**
30-
-**CloudWatch Dashboard** with comprehensive metrics
31-
-**CloudWatch Alarms** for errors, duration, and DLQ
32-
-**Custom Metrics** for application-specific monitoring
33-
-**Structured Logging** with configurable levels
34-
35-
## 🚀 Quick Start
36-
37-
### 1. **Prerequisites**
38-
- AWS CLI configured with appropriate permissions
39-
- Terraform >= 1.3.0 installed
40-
- Unique S3 bucket name ready
41-
42-
### 2. **Configuration**
43-
Edit `terraform.tfvars` and update:
44-
```hcl
45-
# REQUIRED: Change to a globally unique name
46-
s3_bucket_name = "your-unique-complete-lambda-bucket-name"
47-
48-
# OPTIONAL: Add your email for notifications
49-
notification_email = "[email protected]"
50-
51-
# OPTIONAL: Adjust costs by modifying these
52-
provisioned_concurrent_executions = 3 # Reduce to save money
53-
```
54-
55-
### 3. **Deploy**
56-
```bash
57-
# Initialize Terraform
58-
terraform init
59-
60-
# Review the plan (will show ~30 resources)
61-
terraform plan
62-
63-
# Deploy (takes 5-10 minutes)
64-
terraform apply
65-
66-
673
<!-- BEGIN_TF_DOCS -->
684
## Requirements
695

@@ -87,6 +23,7 @@ terraform apply
8723
| <a name="module_arc_security_group"></a> [arc\_security\_group](#module\_arc\_security\_group) | sourcefuse/arc-security-group/aws | 0.0.1 |
8824
| <a name="module_complete_lambda"></a> [complete\_lambda](#module\_complete\_lambda) | ../../ | n/a |
8925
| <a name="module_rds"></a> [rds](#module\_rds) | sourcefuse/arc-db/aws | 4.0.1 |
26+
| <a name="module_s3"></a> [s3](#module\_s3) | sourcefuse/arc-s3/aws | 0.0.4 |
9027
| <a name="module_tags"></a> [tags](#module\_tags) | sourcefuse/arc-tags/aws | 1.2.6 |
9128

9229
## Resources
@@ -108,19 +45,14 @@ terraform apply
10845
| [aws_kms_alias.lambda_key_alias](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_alias) | resource |
10946
| [aws_kms_key.lambda_key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource |
11047
| [aws_lambda_event_source_mapping.sqs_trigger](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_event_source_mapping) | resource |
111-
| [aws_s3_bucket.event_source](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
11248
| [aws_s3_bucket_notification.lambda_notification](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_notification) | resource |
113-
| [aws_s3_bucket_public_access_block.event_source](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
114-
| [aws_s3_bucket_server_side_encryption_configuration.event_source](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
115-
| [aws_s3_bucket_versioning.event_source](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_versioning) | resource |
11649
| [aws_sns_topic.lambda_notifications](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic) | resource |
11750
| [aws_sns_topic_subscription.email_notification](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_subscription) | resource |
11851
| [aws_sns_topic_subscription.lambda_subscription](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sns_topic_subscription) | resource |
11952
| [aws_sqs_queue.lambda_queue](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue) | resource |
12053
| [aws_ssm_parameter.lambda_config](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter) | resource |
12154
| [archive_file.lambda_zip](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
122-
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
123-
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
55+
| [aws_kms_key.sns](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/kms_key) | data source |
12456
| [aws_subnets.private](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnets) | data source |
12557
| [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
12658
| [aws_vpc.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
@@ -129,6 +61,7 @@ terraform apply
12961

13062
| Name | Description | Type | Default | Required |
13163
|------|-------------|------|---------|:--------:|
64+
| <a name="input_acl"></a> [acl](#input\_acl) | ACL value | `string` | n/a | yes |
13265
| <a name="input_alias_name"></a> [alias\_name](#input\_alias\_name) | Name of the Lambda alias | `string` | `"production"` | no |
13366
| <a name="input_api_stage_name"></a> [api\_stage\_name](#input\_api\_stage\_name) | API Gateway stage name | `string` | `"prod"` | no |
13467
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | AWS region for resources | `string` | `"us-east-1"` | no |
@@ -152,26 +85,16 @@ terraform apply
15285

15386
| Name | Description |
15487
|------|-------------|
155-
| <a name="output_api_gateway_rest_api_id"></a> [api\_gateway\_rest\_api\_id](#output\_api\_gateway\_rest\_api\_id) | ID of the API Gateway REST API |
156-
| <a name="output_api_gateway_url"></a> [api\_gateway\_url](#output\_api\_gateway\_url) | URL of the API Gateway endpoint |
88+
| <a name="output_alias_arn"></a> [alias\_arn](#output\_alias\_arn) | ARN of the Lambda alias |
89+
| <a name="output_alias_name"></a> [alias\_name](#output\_alias\_name) | Name of the Lambda alias |
90+
| <a name="output_arn"></a> [arn](#output\_arn) | ARN of the Lambda function |
15791
| <a name="output_cloudwatch_dashboard_url"></a> [cloudwatch\_dashboard\_url](#output\_cloudwatch\_dashboard\_url) | URL to the CloudWatch dashboard |
15892
| <a name="output_dead_letter_queue_arn"></a> [dead\_letter\_queue\_arn](#output\_dead\_letter\_queue\_arn) | ARN of the Dead Letter Queue |
15993
| <a name="output_dead_letter_queue_url"></a> [dead\_letter\_queue\_url](#output\_dead\_letter\_queue\_url) | URL of the Dead Letter Queue |
160-
| <a name="output_eventbridge_rule_name"></a> [eventbridge\_rule\_name](#output\_eventbridge\_rule\_name) | Name of the EventBridge rule |
161-
| <a name="output_kms_key_arn"></a> [kms\_key\_arn](#output\_kms\_key\_arn) | ARN of the KMS key used for encryption |
162-
| <a name="output_kms_key_id"></a> [kms\_key\_id](#output\_kms\_key\_id) | ID of the KMS key used for encryption |
163-
| <a name="output_lambda_alias_arn"></a> [lambda\_alias\_arn](#output\_lambda\_alias\_arn) | ARN of the Lambda alias |
164-
| <a name="output_lambda_alias_name"></a> [lambda\_alias\_name](#output\_lambda\_alias\_name) | Name of the Lambda alias |
165-
| <a name="output_lambda_function_arn"></a> [lambda\_function\_arn](#output\_lambda\_function\_arn) | ARN of the Lambda function |
166-
| <a name="output_lambda_function_name"></a> [lambda\_function\_name](#output\_lambda\_function\_name) | Name of the Lambda function |
167-
| <a name="output_lambda_function_url"></a> [lambda\_function\_url](#output\_lambda\_function\_url) | Lambda function URL (if enabled) |
168-
| <a name="output_lambda_function_version"></a> [lambda\_function\_version](#output\_lambda\_function\_version) | Published version of the Lambda function |
169-
| <a name="output_lambda_insights_url"></a> [lambda\_insights\_url](#output\_lambda\_insights\_url) | URL to Lambda Insights |
170-
| <a name="output_lambda_role_arn"></a> [lambda\_role\_arn](#output\_lambda\_role\_arn) | ARN of the Lambda execution role |
171-
| <a name="output_s3_bucket_arn"></a> [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | ARN of the S3 bucket for event source |
94+
| <a name="output_insights_url"></a> [insights\_url](#output\_insights\_url) | URL to Lambda Insights |
95+
| <a name="output_name"></a> [name](#output\_name) | Name of the Lambda function |
96+
| <a name="output_role_arn"></a> [role\_arn](#output\_role\_arn) | ARN of the Lambda execution role |
17297
| <a name="output_s3_bucket_name"></a> [s3\_bucket\_name](#output\_s3\_bucket\_name) | Name of the S3 bucket for event source |
173-
| <a name="output_sns_topic_arn"></a> [sns\_topic\_arn](#output\_sns\_topic\_arn) | ARN of the SNS topic |
174-
| <a name="output_sqs_queue_arn"></a> [sqs\_queue\_arn](#output\_sqs\_queue\_arn) | ARN of the SQS queue |
175-
| <a name="output_sqs_queue_url"></a> [sqs\_queue\_url](#output\_sqs\_queue\_url) | URL of the SQS queue |
176-
| <a name="output_ssm_parameter_names"></a> [ssm\_parameter\_names](#output\_ssm\_parameter\_names) | Names of the created SSM parameters |
98+
| <a name="output_url"></a> [url](#output\_url) | Lambda function URL (if enabled) |
99+
| <a name="output_version"></a> [version](#output\_version) | Published version of the Lambda function |
177100
<!-- END_TF_DOCS -->

0 commit comments

Comments
 (0)