Skip to content

Commit 49b53e0

Browse files
jmenziessmithmsfussellmarcduiker
authored
Add docs for AWS Cloudmap and Nameformat name resolution components (#4694)
* Add docs for AWS Cloudmap name resolution Signed-off-by: Jon Menzies-Smith <[email protected]> * Add docs for Nameformat name resolution Signed-off-by: Jon Menzies-Smith <[email protected]> * Apply suggestions from code review Co-authored-by: Mark Fussell <[email protected]> Signed-off-by: Jon Menzies-Smith <[email protected]> * Updates from PR Signed-off-by: Jon Menzies-Smith <[email protected]> * Update daprdocs/content/en/reference/components-reference/supported-name-resolution/nr-awscloudmap.md Signed-off-by: Mark Fussell <[email protected]> --------- Signed-off-by: Jon Menzies-Smith <[email protected]> Signed-off-by: Mark Fussell <[email protected]> Co-authored-by: Mark Fussell <[email protected]> Co-authored-by: Marc Duiker <[email protected]>
1 parent 36efb8f commit 49b53e0

File tree

4 files changed

+216
-0
lines changed

4 files changed

+216
-0
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
type: docs
3+
title: "AWS Cloudmap"
4+
linkTitle: "AWS Cloudmap"
5+
description: Detailed information on the AWS Cloudmap name resolution component
6+
---
7+
8+
9+
This component uses [AWS Cloud Map](https://aws.amazon.com/cloud-map/) for service discovery in Dapr. It supports both HTTP and DNS namespaces, allowing services to discover and connect to other services using AWS Cloud Map's service discovery capabilities.
10+
11+
## Configuration format
12+
13+
Name resolution is configured via the [Dapr Configuration]({{< ref configuration-overview.md >}}).
14+
15+
Within the configuration YAML, set the `spec.nameResolution.component` property to `"aws.cloudmap"`, then pass configuration options in the `spec.nameResolution.configuration` dictionary.
16+
17+
```yaml
18+
apiVersion: dapr.io/v1alpha1
19+
kind: Configuration
20+
metadata:
21+
name: appconfig
22+
spec:
23+
nameResolution:
24+
component: "aws.cloudmap"
25+
version: "v1"
26+
configuration:
27+
# Required: AWS CloudMap namespace configuration (one of these is required)
28+
namespaceName: "my-namespace" # The name of your CloudMap namespace
29+
# namespaceId: "ns-xxxxxx" # Alternative: Use namespace ID instead of name
30+
31+
# Optional: AWS authentication (choose one authentication method)
32+
# Option 1: Environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
33+
# Option 2: IAM roles for Amazon EKS
34+
# Option 3: Explicit credentials (not recommended for production)
35+
accessKey: "****"
36+
secretKey: "****"
37+
sessionToken: "****" # Optional
38+
39+
# Optional: AWS region and endpoint configuration
40+
region: "us-west-2"
41+
endpoint: "http://localhost:4566" # Optional: Custom endpoint for testing
42+
43+
# Optional: Dapr configuration
44+
defaultDaprPort: 50002 # Default port for Dapr sidecar if not specified in instance attributes
45+
```
46+
47+
## Specification
48+
49+
### AWS authentication
50+
51+
The component supports multiple authentication methods:
52+
53+
1. Environment Variables:
54+
- AWS_ACCESS_KEY_ID
55+
- AWS_SECRET_ACCESS_KEY
56+
- AWS_SESSION_TOKEN (optional)
57+
58+
2. IAM Roles:
59+
- When running on AWS (EKS, EC2, etc.), the component can use IAM roles
60+
61+
3. Explicit Credentials:
62+
- Provided in the component metadata (not recommended for production)
63+
64+
### Required permissions
65+
66+
The AWS credentials must have the following permissions:
67+
```json
68+
{
69+
"Version": "2012-10-17",
70+
"Statement": [
71+
{
72+
"Effect": "Allow",
73+
"Action": [
74+
"servicediscovery:DiscoverInstances",
75+
"servicediscovery:GetNamespace",
76+
"servicediscovery:ListNamespaces"
77+
],
78+
"Resource": "*"
79+
}
80+
]
81+
}
82+
```
83+
84+
### Spec configuration fields
85+
86+
| Field | Required | Type | Default | Description |
87+
|-----------------|-------------------------------------|--------|---------|-------------|
88+
| namespaceName | One of namespaceName or namespaceId | string | "" | The name of your AWS CloudMap namespace |
89+
| namespaceId | One of namespaceName or namespaceId | string | "" | The ID of your AWS CloudMap namespace |
90+
| region | N | string | "" | AWS region. If not provided, will be determined from environment or instance metadata |
91+
| endpoint | N | string | "" | Custom endpoint for AWS CloudMap API. Useful for testing with LocalStack |
92+
| defaultDaprPort | N | number | 3500 | Default port for Dapr sidecar if not specified in instance attributes |
93+
94+
### Service registration
95+
96+
To use this name resolver, your services must be registered in AWS CloudMap. When registering instances, ensure they have the following attributes:
97+
98+
1. Required: One of these address attributes:
99+
- `AWS_INSTANCE_IPV4`: IPv4 address of the instance
100+
- `AWS_INSTANCE_IPV6`: IPv6 address of the instance
101+
- `AWS_INSTANCE_CNAME`: Hostname of the instance
102+
103+
2. Optional: Dapr sidecar port attribute:
104+
- `DAPR_PORT`: The port that the Dapr sidecar is listening on
105+
- If not specified, the component will use the `defaultDaprPort` from configuration (defaults to 3500)
106+
107+
The resolver only returns healthy instances (those with `HEALTHY` status) to ensure reliable service communication.
108+
109+
Example instance attributes:
110+
```json
111+
{
112+
"AWS_INSTANCE_IPV4": "10.0.0.1",
113+
"DAPR_PORT": "50002"
114+
}
115+
```
116+
117+
118+
## Example Usage
119+
120+
Name resolution is configured via the [Dapr Configuration]({{< ref configuration-overview.md >}}). Here are some examples of its usage.
121+
122+
### Minimal Configuration
123+
124+
```yaml
125+
apiVersion: dapr.io/v1alpha1
126+
kind: Configuration
127+
metadata:
128+
name: appconfig
129+
spec:
130+
nameResolution:
131+
component: "aws.cloudmap"
132+
configuration:
133+
namespaceName: "mynamespace.dev"
134+
defaultDaprPort: 50002
135+
```
136+
137+
### Local Development with LocalStack
138+
139+
```yaml
140+
apiVersion: dapr.io/v1alpha1
141+
kind: Configuration
142+
metadata:
143+
name: appconfig
144+
spec:
145+
nameResolution:
146+
component: "aws.cloudmap"
147+
configuration:
148+
namespaceName: "my-namespace"
149+
region: "us-east-1"
150+
endpoint: "http://localhost:4566"
151+
accessKey: "test"
152+
secretKey: "test"
153+
```
154+
155+
### Related Links
156+
- [Service invocation building block]({{< ref service-invocation >}})
157+
- [AWS Cloudmap documentation](https://aws.amazon.com/cloud-map/)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
type: docs
3+
title: "Nameformat"
4+
linkTitle: "NameFormat"
5+
description: Detailed information on the NameFormat name resolution component
6+
---
7+
8+
9+
The Name Format name resolver provides a flexible way to resolve service names using a configurable format string with placeholders. This is useful in scenarios where you want to map service names to predictable DNS names following a specific pattern.
10+
11+
Consider using this name resolver if there is no specific name resolver available for your service registry, but your service registry can expose services via internal DNS names using predictable naming conventions.
12+
13+
## Configuration Format
14+
15+
Name resolution is configured via the [Dapr Configuration]({{< ref configuration-overview.md >}}).
16+
17+
Within the configuration YAML, set the `spec.nameResolution.component` property to `"nameformat"`, then pass configuration options in the `spec.nameResolution.configuration` dictionary.
18+
19+
```yaml
20+
apiVersion: dapr.io/v1alpha1
21+
kind: Configuration
22+
metadata:
23+
name: appconfig
24+
spec:
25+
nameResolution:
26+
component: "nameformat"
27+
configuration:
28+
format: "service-{appid}.default.svc.cluster.local" # Replace with your desired format pattern
29+
```
30+
31+
## Spec configuration fields
32+
33+
| Field | Required | Details | Example |
34+
|---------|----------|---------|---------|
35+
| format | Y | The format string to use for name resolution. Must contain the `{appid}` placeholder which is replaced with the actual service name. | `"service-{appid}.default.svc.cluster.local"` |
36+
37+
## Examples
38+
39+
When configured with `format: "service-{appid}.default.svc.cluster.local"`, the resolver transforms service names as follows:
40+
41+
- Service ID "myapp" → "service-myapp.default.svc.cluster.local"
42+
- Service ID "frontend" → "service-frontend.default.svc.cluster.local"
43+
44+
45+
## Notes
46+
47+
- Empty service IDs are not allowed and results in an error.
48+
- The format string must be provided in the configuration
49+
- The format string must contain at least one `{appid}` placeholder
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
- component: CloudMap
2+
link: nr-awscloudmap
3+
state: Alpha
4+
version: v1
5+
since: "1.16"

daprdocs/data/components/name_resolution/generic.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@
88
state: Alpha
99
version: v1
1010
since: "1.13"
11+
- component: NameFormat
12+
link: nr-nameformat
13+
state: Alpha
14+
version: v1
15+
since: "1.16"

0 commit comments

Comments
 (0)