AWS Java SDK client for communicating with AWS Lambda Service for function management, invocation, and resource control
npx @tessl/cli install tessl/maven-com-amazonaws--aws-java-sdk-lambda@1.12.00
# AWS Lambda SDK for Java
1
2
The AWS Lambda SDK for Java provides comprehensive programmatic access to AWS Lambda services. It enables developers to manage Lambda functions, layers, aliases, versions, event sources, function URLs, runtime configurations, account settings, and perform function invocations with full type safety and both synchronous and asynchronous execution models.
3
4
## Package Information
5
6
- **Package Name**: aws-java-sdk-lambda
7
- **Package Type**: maven
8
- **Language**: Java
9
- **Group ID**: com.amazonaws
10
- **Artifact ID**: aws-java-sdk-lambda
11
- **Version**: 1.12.791-SNAPSHOT
12
- **Installation**: Add dependency to Maven `pom.xml`:
13
14
```xml
15
<dependency>
16
<groupId>com.amazonaws</groupId>
17
<artifactId>aws-java-sdk-lambda</artifactId>
18
<version>1.12.791-SNAPSHOT</version>
19
</dependency>
20
```
21
22
## Core Imports
23
24
```java
25
import com.amazonaws.services.lambda.AWSLambda;
26
import com.amazonaws.services.lambda.AWSLambdaClientBuilder;
27
import com.amazonaws.services.lambda.model.*;
28
```
29
30
For asynchronous operations:
31
32
```java
33
import com.amazonaws.services.lambda.AWSLambdaAsync;
34
import com.amazonaws.services.lambda.AWSLambdaAsyncClientBuilder;
35
```
36
37
High-level invocation utilities:
38
39
```java
40
import com.amazonaws.services.lambda.invoke.LambdaInvokerFactory;
41
import com.amazonaws.services.lambda.invoke.LambdaFunction;
42
```
43
44
## Basic Usage
45
46
```java
47
import com.amazonaws.services.lambda.*;
48
import com.amazonaws.services.lambda.model.*;
49
50
// Create synchronous client
51
AWSLambda lambdaClient = AWSLambdaClientBuilder.standard()
52
.withRegion("us-east-1")
53
.build();
54
55
// List functions
56
ListFunctionsResult functions = lambdaClient.listFunctions();
57
for (FunctionConfiguration function : functions.getFunctions()) {
58
System.out.println(function.getFunctionName());
59
}
60
61
// Invoke a function
62
InvokeRequest invokeRequest = new InvokeRequest()
63
.withFunctionName("my-function")
64
.withPayload("{\"key\":\"value\"}");
65
66
InvokeResult result = lambdaClient.invoke(invokeRequest);
67
System.out.println(new String(result.getPayload().array()));
68
```
69
70
## Architecture
71
72
The AWS Lambda SDK for Java is built around several key architectural patterns:
73
74
- **Client Interfaces**: Primary entry points (`AWSLambda` for sync, `AWSLambdaAsync` for async operations)
75
- **Builder Pattern**: Fluent client construction with `AWSLambdaClientBuilder` and configuration options
76
- **Request/Result Model**: Strongly-typed request and result objects for all API operations (67 method pairs)
77
- **Exception Hierarchy**: Specific exception types for different error conditions (extensive exception hierarchy)
78
- **Waiter Utilities**: Built-in polling mechanisms for resource state changes via `AWSLambdaWaiters`
79
- **High-level Utilities**: Type-safe proxy generation via `LambdaInvokerFactory` for simplified invocation
80
81
## Capabilities
82
83
### Client Management
84
85
Core client interfaces and builders for creating Lambda service connections with various configuration options.
86
87
```java { .api }
88
public interface AWSLambda {
89
String ENDPOINT_PREFIX = "lambda";
90
// 67 service operations...
91
}
92
93
public interface AWSLambdaAsync extends AWSLambda {
94
// Async versions of all operations returning Future<T>
95
}
96
```
97
98
[Client Management](./client-management.md)
99
100
### Function Management
101
102
Comprehensive function lifecycle operations including creation, configuration, updates, and deletion of Lambda functions.
103
104
```java { .api }
105
CreateFunctionResult createFunction(CreateFunctionRequest request);
106
GetFunctionResult getFunction(GetFunctionRequest request);
107
UpdateFunctionCodeResult updateFunctionCode(UpdateFunctionCodeRequest request);
108
UpdateFunctionConfigurationResult updateFunctionConfiguration(UpdateFunctionConfigurationRequest request);
109
DeleteFunctionResult deleteFunction(DeleteFunctionRequest request);
110
ListFunctionsResult listFunctions(ListFunctionsRequest request);
111
```
112
113
[Function Management](./function-management.md)
114
115
### Function Invocation
116
117
Direct function invocation capabilities supporting synchronous, asynchronous, and dry-run execution modes with full payload control.
118
119
```java { .api }
120
InvokeResult invoke(InvokeRequest request);
121
InvokeAsyncResult invokeAsync(InvokeAsyncRequest request); // Deprecated
122
```
123
124
[Function Invocation](./function-invocation.md)
125
126
### Event Source Mapping
127
128
Management of event source mappings that connect Lambda functions to event sources like DynamoDB, Kinesis, SQS, and Kafka.
129
130
```java { .api }
131
CreateEventSourceMappingResult createEventSourceMapping(CreateEventSourceMappingRequest request);
132
GetEventSourceMappingResult getEventSourceMapping(GetEventSourceMappingRequest request);
133
UpdateEventSourceMappingResult updateEventSourceMapping(UpdateEventSourceMappingRequest request);
134
DeleteEventSourceMappingResult deleteEventSourceMapping(DeleteEventSourceMappingRequest request);
135
ListEventSourceMappingsResult listEventSourceMappings(ListEventSourceMappingsRequest request);
136
```
137
138
[Event Source Mapping](./event-source-mapping.md)
139
140
### Alias and Version Management
141
142
Version control and traffic management through function aliases and immutable versions with support for traffic splitting.
143
144
```java { .api }
145
PublishVersionResult publishVersion(PublishVersionRequest request);
146
CreateAliasResult createAlias(CreateAliasRequest request);
147
UpdateAliasResult updateAlias(UpdateAliasRequest request);
148
ListVersionsByFunctionResult listVersionsByFunction(ListVersionsByFunctionRequest request);
149
ListAliasesResult listAliases(ListAliasesRequest request);
150
```
151
152
[Alias and Version Management](./alias-version-management.md)
153
154
### Layer Management
155
156
Lambda layer operations for managing reusable code packages that can be shared across multiple functions.
157
158
```java { .api }
159
PublishLayerVersionResult publishLayerVersion(PublishLayerVersionRequest request);
160
GetLayerVersionResult getLayerVersion(GetLayerVersionRequest request);
161
DeleteLayerVersionResult deleteLayerVersion(DeleteLayerVersionRequest request);
162
ListLayersResult listLayers(ListLayersRequest request);
163
ListLayerVersionsResult listLayerVersions(ListLayerVersionsRequest request);
164
```
165
166
[Layer Management](./layer-management.md)
167
168
### Concurrency and Performance
169
170
Function concurrency controls including reserved concurrency limits and provisioned concurrency for performance optimization.
171
172
```java { .api }
173
PutFunctionConcurrencyResult putFunctionConcurrency(PutFunctionConcurrencyRequest request);
174
GetFunctionConcurrencyResult getFunctionConcurrency(GetFunctionConcurrencyRequest request);
175
PutProvisionedConcurrencyConfigResult putProvisionedConcurrencyConfig(PutProvisionedConcurrencyConfigRequest request);
176
GetProvisionedConcurrencyConfigResult getProvisionedConcurrencyConfig(GetProvisionedConcurrencyConfigRequest request);
177
```
178
179
[Concurrency and Performance](./concurrency-performance.md)
180
181
### Security and Code Signing
182
183
Code signing configuration and function security features including trusted publisher validation and integrity checks.
184
185
```java { .api }
186
CreateCodeSigningConfigResult createCodeSigningConfig(CreateCodeSigningConfigRequest request);
187
PutFunctionCodeSigningConfigResult putFunctionCodeSigningConfig(PutFunctionCodeSigningConfigRequest request);
188
GetCodeSigningConfigResult getCodeSigningConfig(GetCodeSigningConfigRequest request);
189
ListCodeSigningConfigsResult listCodeSigningConfigs(ListCodeSigningConfigsRequest request);
190
```
191
192
[Security and Code Signing](./security-code-signing.md)
193
194
### Permissions and Policies
195
196
Function permission management including resource-based policies and cross-account access control.
197
198
```java { .api }
199
AddPermissionResult addPermission(AddPermissionRequest request);
200
RemovePermissionResult removePermission(RemovePermissionRequest request);
201
GetPolicyResult getPolicy(GetPolicyRequest request);
202
```
203
204
[Permissions and Policies](./permissions-policies.md)
205
206
### High-Level Invocation Utilities
207
208
Type-safe Lambda function invocation through proxy interfaces with automatic JSON serialization and error handling.
209
210
```java { .api }
211
public class LambdaInvokerFactory {
212
public static LambdaInvokerFactoryConfig builder();
213
public <T> T build(Class<T> interfaceClass);
214
}
215
216
public @interface LambdaFunction {
217
String functionName() default "";
218
}
219
```
220
221
[High-Level Invocation Utilities](./high-level-invocation.md)
222
223
### Waiters and Polling
224
225
Built-in waiter utilities for polling Lambda resources until they reach desired states with configurable retry policies.
226
227
```java { .api }
228
public class AWSLambdaWaiters {
229
public Waiter<GetFunctionRequest> functionExists();
230
public Waiter<GetFunctionConfigurationRequest> functionActive();
231
public Waiter<GetFunctionConfigurationRequest> functionUpdated();
232
public Waiter<GetFunctionConfigurationRequest> publishedVersionActive();
233
}
234
```
235
236
[Waiters and Polling](./waiters-polling.md)
237
238
### Function URL Management
239
240
HTTP(S) endpoint management for Lambda functions providing dedicated URLs for direct function invocation without API Gateway.
241
242
```java { .api }
243
CreateFunctionUrlConfigResult createFunctionUrlConfig(CreateFunctionUrlConfigRequest request);
244
GetFunctionUrlConfigResult getFunctionUrlConfig(GetFunctionUrlConfigRequest request);
245
UpdateFunctionUrlConfigResult updateFunctionUrlConfig(UpdateFunctionUrlConfigRequest request);
246
DeleteFunctionUrlConfigResult deleteFunctionUrlConfig(DeleteFunctionUrlConfigRequest request);
247
ListFunctionUrlConfigsResult listFunctionUrlConfigs(ListFunctionUrlConfigsRequest request);
248
```
249
250
[Function URL Management](./function-url-management.md)
251
252
### Runtime Management
253
254
Configuration and management of Lambda function runtime versions and update policies.
255
256
```java { .api }
257
GetRuntimeManagementConfigResult getRuntimeManagementConfig(GetRuntimeManagementConfigRequest request);
258
PutRuntimeManagementConfigResult putRuntimeManagementConfig(PutRuntimeManagementConfigRequest request);
259
```
260
261
[Runtime Management](./runtime-management.md)
262
263
### Account Settings and Limits
264
265
Retrieve account-level Lambda service configuration, usage statistics, and service limits.
266
267
```java { .api }
268
GetAccountSettingsResult getAccountSettings(GetAccountSettingsRequest request);
269
```
270
271
[Account Settings](./account-settings.md)
272
273
### Resource Tagging
274
275
Management of metadata tags for Lambda functions and resources for organization, cost allocation, and access control.
276
277
```java { .api }
278
TagResourceResult tagResource(TagResourceRequest request);
279
UntagResourceResult untagResource(UntagResourceRequest request);
280
ListTagsResult listTags(ListTagsRequest request);
281
```
282
283
[Resource Tagging](./tagging.md)
284
285
## Types
286
287
```java { .api }
288
// Core configuration types
289
public class FunctionConfiguration {
290
private String functionName;
291
private String functionArn;
292
private Runtime runtime;
293
private String role;
294
private String handler;
295
private Long codeSize;
296
private String description;
297
private Integer timeout;
298
private Integer memorySize;
299
private String lastModified;
300
private String codeSha256;
301
private String version;
302
// ... getters and setters
303
}
304
305
public class FunctionCode {
306
private String zipFile;
307
private String s3Bucket;
308
private String s3Key;
309
private String s3ObjectVersion;
310
private String imageUri;
311
// ... getters and setters
312
}
313
314
// Request/Result pattern
315
public class CreateFunctionRequest {
316
private String functionName;
317
private Runtime runtime;
318
private String role;
319
private String handler;
320
private FunctionCode code;
321
private String description;
322
private Integer timeout;
323
private Integer memorySize;
324
// ... getters and setters
325
}
326
327
// Enumerations
328
public enum InvocationType {
329
Event, RequestResponse, DryRun
330
}
331
332
public enum LogType {
333
None, Tail
334
}
335
336
public enum Runtime {
337
Nodejs("nodejs"),
338
Nodejs43("nodejs4.3"),
339
Nodejs610("nodejs6.10"),
340
Nodejs810("nodejs8.10"),
341
Nodejs10X("nodejs10.x"),
342
Nodejs12X("nodejs12.x"),
343
Nodejs14X("nodejs14.x"),
344
Nodejs16X("nodejs16.x"),
345
Nodejs18X("nodejs18.x"),
346
Nodejs20X("nodejs20.x"),
347
Java8("java8"),
348
Java8Al2("java8.al2"),
349
Java11("java11"),
350
Java17("java17"),
351
Java21("java21"),
352
Python27("python2.7"),
353
Python36("python3.6"),
354
Python37("python3.7"),
355
Python38("python3.8"),
356
Python39("python3.9"),
357
Python310("python3.10"),
358
Python311("python3.11"),
359
Python312("python3.12"),
360
Dotnetcore10("dotnetcore1.0"),
361
Dotnetcore20("dotnetcore2.0"),
362
Dotnetcore21("dotnetcore2.1"),
363
Dotnetcore31("dotnetcore3.1"),
364
Dotnet6("dotnet6"),
365
Dotnet8("dotnet8"),
366
Go1X("go1.x"),
367
Ruby25("ruby2.5"),
368
Ruby27("ruby2.7"),
369
Ruby32("ruby3.2"),
370
Ruby33("ruby3.3"),
371
Provided("provided"),
372
ProvidedAl2("provided.al2"),
373
ProvidedAl2023("provided.al2023")
374
}
375
```