aws-cdk.aws-servicediscovery


Nameaws-cdk.aws-servicediscovery JSON
Version 1.204.0 PyPI version JSON
download
home_pagehttps://github.com/aws/aws-cdk
SummaryThe CDK Construct Library for AWS::ServiceDiscovery
upload_time2023-06-19 21:07:25
maintainer
docs_urlNone
authorAmazon Web Services
requires_python~=3.7
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Amazon ECS Service Discovery Construct Library

<!--BEGIN STABILITY BANNER-->---


![End-of-Support](https://img.shields.io/badge/End--of--Support-critical.svg?style=for-the-badge)

> AWS CDK v1 has reached End-of-Support on 2023-06-01.
> This package is no longer being updated, and users should migrate to AWS CDK v2.
>
> For more information on how to migrate, see the [*Migrating to AWS CDK v2* guide](https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html).

---
<!--END STABILITY BANNER-->

This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

This package contains constructs for working with **AWS Cloud Map**

AWS Cloud Map is a fully managed service that you can use to create and
maintain a map of the backend services and resources that your applications
depend on.

For further information on AWS Cloud Map,
see the [AWS Cloud Map documentation](https://docs.aws.amazon.com/cloud-map)

## HTTP Namespace Example

The following example creates an AWS Cloud Map namespace that
supports API calls, creates a service in that namespace, and
registers an instance to it:

```python
import aws_cdk.core as cdk
import aws_cdk.aws_servicediscovery as servicediscovery

app = cdk.App()
stack = cdk.Stack(app, "aws-servicediscovery-integ")

namespace = servicediscovery.HttpNamespace(stack, "MyNamespace",
    name="covfefe"
)

service1 = namespace.create_service("NonIpService",
    description="service registering non-ip instances"
)

service1.register_non_ip_instance("NonIpInstance",
    custom_attributes={"arn": "arn:aws:s3:::mybucket"}
)

service2 = namespace.create_service("IpService",
    description="service registering ip instances",
    health_check=servicediscovery.HealthCheckConfig(
        type=servicediscovery.HealthCheckType.HTTP,
        resource_path="/check"
    )
)

service2.register_ip_instance("IpInstance",
    ipv4="54.239.25.192"
)

app.synth()
```

## Private DNS Namespace Example

The following example creates an AWS Cloud Map namespace that
supports both API calls and DNS queries within a vpc, creates a
service in that namespace, and registers a loadbalancer as an
instance:

```python
import aws_cdk.aws_ec2 as ec2
import aws_cdk.aws_elasticloadbalancingv2 as elbv2
import aws_cdk.core as cdk
import aws_cdk.aws_servicediscovery as servicediscovery

app = cdk.App()
stack = cdk.Stack(app, "aws-servicediscovery-integ")

vpc = ec2.Vpc(stack, "Vpc", max_azs=2)

namespace = servicediscovery.PrivateDnsNamespace(stack, "Namespace",
    name="boobar.com",
    vpc=vpc
)

service = namespace.create_service("Service",
    dns_record_type=servicediscovery.DnsRecordType.A_AAAA,
    dns_ttl=cdk.Duration.seconds(30),
    load_balancer=True
)

loadbalancer = elbv2.ApplicationLoadBalancer(stack, "LB", vpc=vpc, internet_facing=True)

service.register_load_balancer("Loadbalancer", loadbalancer)

app.synth()
```

## Public DNS Namespace Example

The following example creates an AWS Cloud Map namespace that
supports both API calls and public DNS queries, creates a service in
that namespace, and registers an IP instance:

```python
import aws_cdk.core as cdk
import aws_cdk.aws_servicediscovery as servicediscovery

app = cdk.App()
stack = cdk.Stack(app, "aws-servicediscovery-integ")

namespace = servicediscovery.PublicDnsNamespace(stack, "Namespace",
    name="foobar.com"
)

service = namespace.create_service("Service",
    name="foo",
    dns_record_type=servicediscovery.DnsRecordType.A,
    dns_ttl=cdk.Duration.seconds(30),
    health_check=servicediscovery.HealthCheckConfig(
        type=servicediscovery.HealthCheckType.HTTPS,
        resource_path="/healthcheck",
        failure_threshold=2
    )
)

service.register_ip_instance("IpInstance",
    ipv4="54.239.25.192",
    port=443
)

app.synth()
```

For DNS namespaces, you can also register instances to services with CNAME records:

```python
import aws_cdk.core as cdk
import aws_cdk.aws_servicediscovery as servicediscovery

app = cdk.App()
stack = cdk.Stack(app, "aws-servicediscovery-integ")

namespace = servicediscovery.PublicDnsNamespace(stack, "Namespace",
    name="foobar.com"
)

service = namespace.create_service("Service",
    name="foo",
    dns_record_type=servicediscovery.DnsRecordType.CNAME,
    dns_ttl=cdk.Duration.seconds(30)
)

service.register_cname_instance("CnameInstance",
    instance_cname="service.pizza"
)

app.synth()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aws/aws-cdk",
    "name": "aws-cdk.aws-servicediscovery",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Amazon Web Services",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/c3/29/9a181cc7aa2bd13f6277ec86b424a2802299a030d9a45ce3fcb5b1be33bc/aws-cdk.aws-servicediscovery-1.204.0.tar.gz",
    "platform": null,
    "description": "# Amazon ECS Service Discovery Construct Library\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![End-of-Support](https://img.shields.io/badge/End--of--Support-critical.svg?style=for-the-badge)\n\n> AWS CDK v1 has reached End-of-Support on 2023-06-01.\n> This package is no longer being updated, and users should migrate to AWS CDK v2.\n>\n> For more information on how to migrate, see the [*Migrating to AWS CDK v2* guide](https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html).\n\n---\n<!--END STABILITY BANNER-->\n\nThis module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.\n\nThis package contains constructs for working with **AWS Cloud Map**\n\nAWS Cloud Map is a fully managed service that you can use to create and\nmaintain a map of the backend services and resources that your applications\ndepend on.\n\nFor further information on AWS Cloud Map,\nsee the [AWS Cloud Map documentation](https://docs.aws.amazon.com/cloud-map)\n\n## HTTP Namespace Example\n\nThe following example creates an AWS Cloud Map namespace that\nsupports API calls, creates a service in that namespace, and\nregisters an instance to it:\n\n```python\nimport aws_cdk.core as cdk\nimport aws_cdk.aws_servicediscovery as servicediscovery\n\napp = cdk.App()\nstack = cdk.Stack(app, \"aws-servicediscovery-integ\")\n\nnamespace = servicediscovery.HttpNamespace(stack, \"MyNamespace\",\n    name=\"covfefe\"\n)\n\nservice1 = namespace.create_service(\"NonIpService\",\n    description=\"service registering non-ip instances\"\n)\n\nservice1.register_non_ip_instance(\"NonIpInstance\",\n    custom_attributes={\"arn\": \"arn:aws:s3:::mybucket\"}\n)\n\nservice2 = namespace.create_service(\"IpService\",\n    description=\"service registering ip instances\",\n    health_check=servicediscovery.HealthCheckConfig(\n        type=servicediscovery.HealthCheckType.HTTP,\n        resource_path=\"/check\"\n    )\n)\n\nservice2.register_ip_instance(\"IpInstance\",\n    ipv4=\"54.239.25.192\"\n)\n\napp.synth()\n```\n\n## Private DNS Namespace Example\n\nThe following example creates an AWS Cloud Map namespace that\nsupports both API calls and DNS queries within a vpc, creates a\nservice in that namespace, and registers a loadbalancer as an\ninstance:\n\n```python\nimport aws_cdk.aws_ec2 as ec2\nimport aws_cdk.aws_elasticloadbalancingv2 as elbv2\nimport aws_cdk.core as cdk\nimport aws_cdk.aws_servicediscovery as servicediscovery\n\napp = cdk.App()\nstack = cdk.Stack(app, \"aws-servicediscovery-integ\")\n\nvpc = ec2.Vpc(stack, \"Vpc\", max_azs=2)\n\nnamespace = servicediscovery.PrivateDnsNamespace(stack, \"Namespace\",\n    name=\"boobar.com\",\n    vpc=vpc\n)\n\nservice = namespace.create_service(\"Service\",\n    dns_record_type=servicediscovery.DnsRecordType.A_AAAA,\n    dns_ttl=cdk.Duration.seconds(30),\n    load_balancer=True\n)\n\nloadbalancer = elbv2.ApplicationLoadBalancer(stack, \"LB\", vpc=vpc, internet_facing=True)\n\nservice.register_load_balancer(\"Loadbalancer\", loadbalancer)\n\napp.synth()\n```\n\n## Public DNS Namespace Example\n\nThe following example creates an AWS Cloud Map namespace that\nsupports both API calls and public DNS queries, creates a service in\nthat namespace, and registers an IP instance:\n\n```python\nimport aws_cdk.core as cdk\nimport aws_cdk.aws_servicediscovery as servicediscovery\n\napp = cdk.App()\nstack = cdk.Stack(app, \"aws-servicediscovery-integ\")\n\nnamespace = servicediscovery.PublicDnsNamespace(stack, \"Namespace\",\n    name=\"foobar.com\"\n)\n\nservice = namespace.create_service(\"Service\",\n    name=\"foo\",\n    dns_record_type=servicediscovery.DnsRecordType.A,\n    dns_ttl=cdk.Duration.seconds(30),\n    health_check=servicediscovery.HealthCheckConfig(\n        type=servicediscovery.HealthCheckType.HTTPS,\n        resource_path=\"/healthcheck\",\n        failure_threshold=2\n    )\n)\n\nservice.register_ip_instance(\"IpInstance\",\n    ipv4=\"54.239.25.192\",\n    port=443\n)\n\napp.synth()\n```\n\nFor DNS namespaces, you can also register instances to services with CNAME records:\n\n```python\nimport aws_cdk.core as cdk\nimport aws_cdk.aws_servicediscovery as servicediscovery\n\napp = cdk.App()\nstack = cdk.Stack(app, \"aws-servicediscovery-integ\")\n\nnamespace = servicediscovery.PublicDnsNamespace(stack, \"Namespace\",\n    name=\"foobar.com\"\n)\n\nservice = namespace.create_service(\"Service\",\n    name=\"foo\",\n    dns_record_type=servicediscovery.DnsRecordType.CNAME,\n    dns_ttl=cdk.Duration.seconds(30)\n)\n\nservice.register_cname_instance(\"CnameInstance\",\n    instance_cname=\"service.pizza\"\n)\n\napp.synth()\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "The CDK Construct Library for AWS::ServiceDiscovery",
    "version": "1.204.0",
    "project_urls": {
        "Homepage": "https://github.com/aws/aws-cdk",
        "Source": "https://github.com/aws/aws-cdk.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "01ceec178d571b9c6cd6c2e5dbc609db055e51b7f91617c6dba2ba08320f14b3",
                "md5": "bb2eedf015b69ec849f3c4f5eced64ae",
                "sha256": "6d2ef44db06e4a540f5279fc750ad1ce677de7fb2db40f7e666504145b4710ba"
            },
            "downloads": -1,
            "filename": "aws_cdk.aws_servicediscovery-1.204.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bb2eedf015b69ec849f3c4f5eced64ae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.7",
            "size": 174505,
            "upload_time": "2023-06-19T21:01:20",
            "upload_time_iso_8601": "2023-06-19T21:01:20.879191Z",
            "url": "https://files.pythonhosted.org/packages/01/ce/ec178d571b9c6cd6c2e5dbc609db055e51b7f91617c6dba2ba08320f14b3/aws_cdk.aws_servicediscovery-1.204.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c3299a181cc7aa2bd13f6277ec86b424a2802299a030d9a45ce3fcb5b1be33bc",
                "md5": "7d4ac4d07b9a9abe9e5470519a66a4b8",
                "sha256": "23799549fee8e71bee6cb835cacc401a6e5a31511c3acf7e07305e9c2039df2d"
            },
            "downloads": -1,
            "filename": "aws-cdk.aws-servicediscovery-1.204.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7d4ac4d07b9a9abe9e5470519a66a4b8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.7",
            "size": 174847,
            "upload_time": "2023-06-19T21:07:25",
            "upload_time_iso_8601": "2023-06-19T21:07:25.160973Z",
            "url": "https://files.pythonhosted.org/packages/c3/29/9a181cc7aa2bd13f6277ec86b424a2802299a030d9a45ce3fcb5b1be33bc/aws-cdk.aws-servicediscovery-1.204.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-19 21:07:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aws",
    "github_project": "aws-cdk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aws-cdk.aws-servicediscovery"
}
        
Elapsed time: 0.10189s