Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 01fc09c

Browse files
authored
Lambda: Include support for custom URL aliases (#1410)
1 parent f5d8bc5 commit 01fc09c

File tree

1 file changed

+29
-10
lines changed
  • content/en/user-guide/aws/lambda

1 file changed

+29
-10
lines changed

content/en/user-guide/aws/lambda/index.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,10 @@ $ awslocal lambda create-function \
6666
--handler index.handler \
6767
--role arn:aws:iam::000000000000:role/lambda-role \
6868
--tags '{"_custom_id_":"my-custom-subdomain"}'
69-
$ awslocal lambda create-function-url-config \
70-
--function-name localstack-lambda-url-example \
71-
--auth-type NONE
72-
{
73-
"FunctionUrl": "http://my-custom-subdomain.lambda-url.<region>...",
74-
....
75-
}
7669
{{< / command >}}
77-
You must specify the `_custom_id_` tag **before** using the `create-function-url-config` command.
70+
You must specify the `_custom_id_` tag **before** <a href="#create-a-function-url">creating a Function URL</a>.
7871
After the URL configuration is set up, any modifications to the tag will not affect it.
79-
At present, custom IDs can be assigned only to the `$LATEST` version of the function.
80-
LocalStack does not yet support custom IDs for function version aliases.
72+
LocalStack supports assigning custom IDs to both the `$LATEST` version of the function or to an existing version alias.
8173
{{< /callout >}}
8274

8375
{{< callout >}}
@@ -124,6 +116,33 @@ $ awslocal lambda create-function-url-config \
124116
This will generate a HTTP URL that can be used to invoke the Lambda function.
125117
The URL will be in the format `http://<XXXXXXXX>.lambda-url.us-east-1.localhost.localstack.cloud:4566`.
126118

119+
{{< callout "note">}}
120+
As previously mentioned, when a Lambda Function has a `_custom_id_` tag, LocalStack sets this tag's value as the subdomain in the Function's URL.
121+
122+
{{< command >}}
123+
$ awslocal lambda create-function-url-config \
124+
--function-name localstack-lambda-url-example \
125+
--auth-type NONE
126+
{
127+
"FunctionUrl": "http://my-custom-subdomain.lambda-url.<region>...",
128+
....
129+
}
130+
{{< / command >}}
131+
132+
In addition, if you pass an an existing version alias as a `Qualifier` to the request, the created URL will combine the custom ID and the alias in the form `<custom-id>-<alias>`.
133+
134+
{{< command >}}
135+
$ awslocal lambda create-function-url-config \
136+
--function-name localstack-lambda-url-example \
137+
--auth-type NONE
138+
--qualifier test-alias
139+
{
140+
"FunctionUrl": "http://my-custom-subdomain-test-alias.lambda-url.<region>...",
141+
....
142+
}
143+
{{< / command >}}
144+
{{< /callout >}}
145+
127146
### Trigger the Lambda function URL
128147

129148
You can now trigger the Lambda function by sending a HTTP POST request to the URL using [curl](https://curl.se/) or your REST HTTP client:

0 commit comments

Comments
 (0)