CloudMapNamespaceOptions
- class aws_cdk.aws_ecs.CloudMapNamespaceOptions(*, name, type=None, use_for_service_connect=None, vpc=None)
Bases:
object
The options for creating an AWS Cloud Map namespace.
- Parameters:
name (
str
) – The name of the namespace, such as example.com.type (
Optional
[NamespaceType
]) – The type of CloudMap Namespace to create. Default: PrivateDnsuse_for_service_connect (
Optional
[bool
]) – This property specifies whether to set the provided namespace as the service connect default in the cluster properties. Default: falsevpc (
Optional
[IVpc
]) – The VPC to associate the namespace with. This property is required for private DNS namespaces. Default: VPC of the cluster for Private DNS Namespace, otherwise none
- ExampleMetadata:
infused
Example:
# cluster: ecs.Cluster # task_definition: ecs.TaskDefinition # container_options: ecs.ContainerDefinitionOptions container = task_definition.add_container("MyContainer", container_options) container.add_port_mappings( name="api", container_port=8080 ) cluster.add_default_cloud_map_namespace( name="local" ) service = ecs.FargateService(self, "Service", cluster=cluster, task_definition=task_definition, service_connect_configuration=ecs.ServiceConnectProps( services=[ecs.ServiceConnectService( port_mapping_name="api", dns_name="http-api", port=80 ) ] ) )
Attributes
- name
The name of the namespace, such as example.com.
- type
The type of CloudMap Namespace to create.
- Default:
PrivateDns
- use_for_service_connect
This property specifies whether to set the provided namespace as the service connect default in the cluster properties.
- Default:
false
- vpc
The VPC to associate the namespace with.
This property is required for private DNS namespaces.
- Default:
VPC of the cluster for Private DNS Namespace, otherwise none