@@ -10,15 +10,17 @@ The application configuration is managed through environment variables. These va
1010
1111The following environment variables are available for configuring the application:
1212
13- | Variable | Type | Description | Default | Required |
14- | ---------------------- | ------- | ------------------------------------------------ | ----------- | -------- |
15- | ` TASKS_TABLE ` | string | The name of the DynamoDB table for storing tasks | - | Yes |
16- | ` TASK_EVENT_TOPIC_ARN ` | string | The ARN of the SNS topic for task events | - | Yes |
17- | ` AWS_REGION ` | string | The AWS region where resources are deployed | ` us-east-1 ` | No |
18- | ` LOGGING_ENABLED ` | boolean | Enable or disable application logging | ` true ` | No |
19- | ` LOGGING_LEVEL ` | enum | Logging level: ` debug ` , ` info ` , ` warn ` , ` error ` | ` debug ` | No |
20- | ` LOGGING_FORMAT ` | enum | Logging format: ` text ` , ` json ` | ` json ` | No |
21- | ` CORS_ALLOW_ORIGIN ` | string | CORS allow origin header value | ` * ` | No |
13+ | Variable | Type | Description | Default | Required |
14+ | ---------------------- | ------- | ------------------------------------------------ | ------------------------ | -------- |
15+ | ` TASKS_TABLE ` | string | The name of the DynamoDB table for storing tasks | - | Yes |
16+ | ` TASK_EVENT_TOPIC_ARN ` | string | The ARN of the SNS topic for task events | - | Yes |
17+ | ` AWS_REGION ` | string | The AWS region where resources are deployed | ` us-east-1 ` | No |
18+ | ` USE_LOCALSTACK ` | boolean | Enable LocalStack mode for local development | ` false ` | No |
19+ | ` LOCALSTACK_ENDPOINT ` | string | LocalStack endpoint URL | ` http://localstack:4566 ` | No |
20+ | ` LOGGING_ENABLED ` | boolean | Enable or disable application logging | ` true ` | No |
21+ | ` LOGGING_LEVEL ` | enum | Logging level: ` debug ` , ` info ` , ` warn ` , ` error ` | ` debug ` | No |
22+ | ` LOGGING_FORMAT ` | enum | Logging format: ` text ` , ` json ` | ` json ` | No |
23+ | ` CORS_ALLOW_ORIGIN ` | string | CORS allow origin header value | ` * ` | No |
2224
2325### Usage
2426
@@ -46,18 +48,20 @@ The infrastructure configuration is managed through environment variables prefix
4648
4749The following environment variables are available for configuring the infrastructure:
4850
49- | Variable | Type | Description | Default | Required |
50- | ------------------------- | ------- | ------------------------------------------------------ | ---------------- | -------- |
51- | ` CDK_APP_NAME ` | string | The application name used in resource naming | ` lambda-starter ` | No |
52- | ` CDK_ENV ` | enum | Environment: ` dev ` , ` qat ` , ` prd ` | - | Yes |
53- | ` CDK_ACCOUNT ` | string | AWS account ID for deployment | - | No |
54- | ` CDK_REGION ` | string | AWS region for deployment | - | No |
55- | ` CDK_OU ` | string | Organizational Unit for resource tagging | ` leanstacks ` | No |
56- | ` CDK_OWNER ` | string | Owner tag for resource tracking | ` unknown ` | No |
57- | ` CDK_CORS_ALLOW_ORIGIN ` | string | CORS allow origin for API Gateway and Lambda functions | ` * ` | No |
58- | ` CDK_APP_LOGGING_ENABLED ` | boolean | Enable logging in Lambda functions | ` true ` | No |
59- | ` CDK_APP_LOGGING_LEVEL ` | enum | Logging level: ` debug ` , ` info ` , ` warn ` , ` error ` | ` info ` | No |
60- | ` CDK_APP_LOGGING_FORMAT ` | enum | Logging format: ` text ` , ` json ` | ` json ` | No |
51+ | Variable | Type | Description | Default | Required |
52+ | ------------------------- | ------- | ------------------------------------------------------ | ----------------------- | -------- |
53+ | ` CDK_APP_NAME ` | string | The application name used in resource naming | ` lambda-starter ` | No |
54+ | ` CDK_ENV ` | enum | Environment: ` local ` , ` dev ` , ` qat ` , ` prd ` | - | Yes |
55+ | ` CDK_ACCOUNT ` | string | AWS account ID for deployment | - | No |
56+ | ` CDK_REGION ` | string | AWS region for deployment | - | No |
57+ | ` CDK_USE_LOCALSTACK ` | boolean | Enable LocalStack mode for local development | ` false ` | No |
58+ | ` CDK_LOCALSTACK_ENDPOINT ` | string | LocalStack endpoint URL | ` http://localhost:4566 ` | No |
59+ | ` CDK_OU ` | string | Organizational Unit for resource tagging | ` leanstacks ` | No |
60+ | ` CDK_OWNER ` | string | Owner tag for resource tracking | ` unknown ` | No |
61+ | ` CDK_CORS_ALLOW_ORIGIN ` | string | CORS allow origin for API Gateway and Lambda functions | ` * ` | No |
62+ | ` CDK_APP_LOGGING_ENABLED ` | boolean | Enable logging in Lambda functions | ` true ` | No |
63+ | ` CDK_APP_LOGGING_LEVEL ` | enum | Logging level: ` debug ` , ` info ` , ` warn ` , ` error ` | ` info ` | No |
64+ | ` CDK_APP_LOGGING_FORMAT ` | enum | Logging format: ` text ` , ` json ` | ` json ` | No |
6165
6266### Usage
6367
@@ -78,18 +82,70 @@ Infrastructure configuration can be provided through:
78821 . ** Environment variables** - Set directly in your shell or CI/CD pipeline
79832 . ** .env file** - Create a ` .env ` file in the ` infrastructure/ ` directory for local development
8084
81- Example ` .env ` file:
85+ Example ` .env ` file for AWS deployment :
8286
8387``` bash
88+ # #################################################
89+ # ### Infrastructure Environment Configuration ####
90+ # #################################################
91+
92+ # ## Application Configuration ###
93+ # # Application name (default: lambda-starter)
94+ CDK_APP_NAME=lambda-starter
95+ # # The infrastructure environment (dev, qat, prd)
8496CDK_ENV=dev
85- CDK_ACCOUNT=123456789012
97+
98+ # ## Resource Tagging Configuration ###
99+ # # Organizational Unit (e.g., software-engineering, shared-services)
100+ CDK_OU=software-engineering
101+ # # Owner of the infrastructure resources (e.g., team-alpha, Joe Engineer)
102+ CDK_OWNER=microservices-team
103+
104+ # ## Logging Configuration ###
105+ # # Application logging level: debug, info, warn, error (default: info)
106+ CDK_APP_LOGGING_LEVEL=debug
107+ ```
108+
109+ Example ` .env ` file for LocalStack local development:
110+
111+ ``` bash
112+ # #################################################
113+ # ### LocalStack Environment Configuration #######
114+ # #################################################
115+
116+ # ## Application Configuration ###
117+ # # Application name (default: lambda-starter)
118+ CDK_APP_NAME=lambda-starter
119+ # # The infrastructure environment (local for LocalStack)
120+ CDK_ENV=local
121+
122+ # ## LocalStack Configuration ###
123+ # # Enable LocalStack mode
124+ CDK_USE_LOCALSTACK=true
125+ # # LocalStack endpoint (default: http://localstack:4566)
126+ CDK_LOCALSTACK_ENDPOINT=http://localstack:4566
127+
128+ # ## AWS Configuration ###
129+ # # AWS Region for LocalStack (default: us-east-1)
86130CDK_REGION=us-east-1
87- CDK_OU=leanstacks
88- CDK_OWNER=platform-team
89- CDK_CORS_ALLOW_ORIGIN=https://example.com
131+
132+ # ## Resource Tagging Configuration ###
133+ # # Organizational Unit
134+ CDK_OU=software-engineering
135+ # # Owner of the infrastructure resources
136+ CDK_OWNER=local-dev
137+
138+ # ## Logging Configuration ###
139+ # # Enable application logging
90140CDK_APP_LOGGING_ENABLED=true
141+ # # Application logging level: debug, info, warn, error
91142CDK_APP_LOGGING_LEVEL=debug
92- CDK_APP_LOGGING_FORMAT=json
143+ # # Application logging format: text, json (text is easier to read locally)
144+ CDK_APP_LOGGING_FORMAT=text
145+
146+ # ## CORS Configuration ###
147+ # # CORS allow origin for API Gateway (allowing all for local development)
148+ CDK_CORS_ALLOW_ORIGIN=*
93149```
94150
95151** Important:** Never commit ` .env ` files containing sensitive information to source control.
@@ -98,19 +154,30 @@ CDK_APP_LOGGING_FORMAT=json
98154
99155All AWS resources created by the CDK are automatically tagged with the following tags:
100156
101- | Tag | Description | Source |
102- | ------- | ------------------------------ | -------------- |
103- | ` App ` | Application name | ` CDK_APP_NAME ` |
104- | ` Env ` | Environment (dev, qat, prd) | ` CDK_ENV ` |
105- | ` OU ` | Organizational Unit | ` CDK_OU ` |
106- | ` Owner ` | Team or individual responsible | ` CDK_OWNER ` |
157+ | Tag | Description | Source |
158+ | ------- | ---------------------------------- | -------------- |
159+ | ` App ` | Application name | ` CDK_APP_NAME ` |
160+ | ` Env ` | Environment (local, dev, qat, prd) | ` CDK_ENV ` |
161+ | ` OU ` | Organizational Unit | ` CDK_OU ` |
162+ | ` Owner ` | Team or individual responsible | ` CDK_OWNER ` |
107163
108164These tags are used for cost allocation, resource management, and identifying resources in AWS.
109165
110166### Environment-Specific Settings
111167
112168Different environments may require different configuration values. Consider these recommendations:
113169
170+ #### LocalStack (local)
171+
172+ - ` CDK_ENV=local ` - Enables LocalStack mode
173+ - ` CDK_USE_LOCALSTACK=true ` - Required for LocalStack
174+ - ` CDK_LOCALSTACK_ENDPOINT=http://localstack:4566 ` - LocalStack endpoint (uses Docker container hostname)
175+ - ` CDK_APP_LOGGING_LEVEL=debug ` - Verbose logging for development
176+ - ` CDK_APP_LOGGING_FORMAT=text ` - Human-readable logs for local debugging
177+ - ` CDK_CORS_ALLOW_ORIGIN=* ` - Allow all origins for local testing
178+ - No AWS account required - LocalStack uses mock credentials
179+ - See the [ LocalStack Guide] ( LocalStackGuide.md ) for complete setup instructions
180+
114181#### Development (dev)
115182
116183- ` CDK_APP_LOGGING_LEVEL=debug ` - Verbose logging for development
@@ -152,6 +219,8 @@ Infrastructure configuration variables are passed to Lambda functions with modif
152219
153220| Infrastructure Variable | Lambda Environment Variable |
154221| ------------------------- | --------------------------- |
222+ | ` CDK_USE_LOCALSTACK ` | ` USE_LOCALSTACK ` |
223+ | ` CDK_LOCALSTACK_ENDPOINT ` | ` LOCALSTACK_ENDPOINT ` |
155224| ` CDK_APP_LOGGING_ENABLED ` | ` LOGGING_ENABLED ` |
156225| ` CDK_APP_LOGGING_LEVEL ` | ` LOGGING_LEVEL ` |
157226| ` CDK_APP_LOGGING_FORMAT ` | ` LOGGING_FORMAT ` |
0 commit comments