docs
0
# Function URL Management
1
2
Lambda Function URLs provide dedicated HTTP(S) endpoints for direct function invocation without requiring API Gateway. This capability enables simplified web applications and microservices with native Lambda integration.
3
4
## Capabilities
5
6
### Create Function URL Configuration
7
8
Creates a dedicated HTTP(S) endpoint for a Lambda function with configurable authentication and CORS settings.
9
10
```java { .api }
11
/**
12
* Creates a Lambda function URL with the specified configuration parameters
13
* @param createFunctionUrlConfigRequest - Configuration for the function URL
14
* @return CreateFunctionUrlConfigResult containing the function URL and creation details
15
*/
16
CreateFunctionUrlConfigResult createFunctionUrlConfig(CreateFunctionUrlConfigRequest createFunctionUrlConfigRequest);
17
```
18
19
**Usage Example:**
20
21
```java
22
import com.amazonaws.services.lambda.*;
23
import com.amazonaws.services.lambda.model.*;
24
25
AWSLambda lambdaClient = AWSLambdaClientBuilder.standard()
26
.withRegion("us-east-1")
27
.build();
28
29
// Create function URL with IAM authentication
30
CreateFunctionUrlConfigRequest createRequest = new CreateFunctionUrlConfigRequest()
31
.withFunctionName("my-function")
32
.withAuthType(FunctionUrlAuthType.AWS_IAM)
33
.withCors(new Cors()
34
.withAllowCredentials(true)
35
.withAllowHeaders("Content-Type", "X-Amz-Date")
36
.withAllowMethods("GET", "POST")
37
.withAllowOrigins("*")
38
.withMaxAge(300));
39
40
CreateFunctionUrlConfigResult result = lambdaClient.createFunctionUrlConfig(createRequest);
41
System.out.println("Function URL: " + result.getFunctionUrl());
42
```
43
44
### Get Function URL Configuration
45
46
Retrieves the current configuration for a Lambda function URL.
47
48
```java { .api }
49
/**
50
* Returns details about a Lambda function URL
51
* @param getFunctionUrlConfigRequest - Request specifying the function name
52
* @return GetFunctionUrlConfigResult with URL configuration details
53
*/
54
GetFunctionUrlConfigResult getFunctionUrlConfig(GetFunctionUrlConfigRequest getFunctionUrlConfigRequest);
55
```
56
57
### Update Function URL Configuration
58
59
Modifies the configuration of an existing Lambda function URL.
60
61
```java { .api }
62
/**
63
* Updates the configuration for a Lambda function URL
64
* @param updateFunctionUrlConfigRequest - Updated configuration parameters
65
* @return UpdateFunctionUrlConfigResult with updated configuration
66
*/
67
UpdateFunctionUrlConfigResult updateFunctionUrlConfig(UpdateFunctionUrlConfigRequest updateFunctionUrlConfigRequest);
68
```
69
70
### Delete Function URL Configuration
71
72
Removes the function URL configuration, making the endpoint no longer accessible.
73
74
```java { .api }
75
/**
76
* Deletes a Lambda function URL
77
* @param deleteFunctionUrlConfigRequest - Request specifying the function name
78
* @return DeleteFunctionUrlConfigResult confirming deletion
79
*/
80
DeleteFunctionUrlConfigResult deleteFunctionUrlConfig(DeleteFunctionUrlConfigRequest deleteFunctionUrlConfigRequest);
81
```
82
83
### List Function URL Configurations
84
85
Retrieves a list of function URLs for the specified function.
86
87
```java { .api }
88
/**
89
* Returns a list of Lambda function URLs for the specified function
90
* @param listFunctionUrlConfigsRequest - Request with function name and optional filters
91
* @return ListFunctionUrlConfigsResult containing function URL configurations
92
*/
93
ListFunctionUrlConfigsResult listFunctionUrlConfigs(ListFunctionUrlConfigsRequest listFunctionUrlConfigsRequest);
94
```
95
96
## Types
97
98
```java { .api }
99
// Authentication types for function URLs
100
public enum FunctionUrlAuthType {
101
AWS_IAM, NONE
102
}
103
104
// CORS configuration for function URLs
105
public class Cors {
106
private Boolean allowCredentials;
107
private java.util.List<String> allowHeaders;
108
private java.util.List<String> allowMethods;
109
private java.util.List<String> allowOrigins;
110
private java.util.List<String> exposeHeaders;
111
private Integer maxAge;
112
// ... getters and setters
113
}
114
115
// Function URL configuration
116
public class FunctionUrlConfig {
117
private String functionUrl;
118
private String functionArn;
119
private String creationTime;
120
private String lastModifiedTime;
121
private FunctionUrlAuthType authType;
122
private Cors cors;
123
// ... getters and setters
124
}
125
```