This message was deleted.
# aws
s
This message was deleted.
c
When you create an ECS service and want to utilize Service Discovery via CloudMap & Route53 you first need to create your Cloudmap Namespace/Domain, then you create you service registry, which then when a task spins up it registers via the Service Discovery Service registration
ServiceDiscoveryNamespace -> ServiceDiscovery Service Registration -> Tie Service Registration to ECS Service for IP's to map to service name.
i
really appreciate the help. any idea how I can then pipe the resulting service discovery hostname into another pulumi component? I’m attempting to pass the hostname created by the service discovery service in as an env variable to a different ECS service
Copy code
let myAppServiceRegistryService = new aws.servicediscovery.Service("myApp", {
    dnsConfig: {
        namespaceId: nodeServiceDiscoveryNamespace.id,
        dnsRecords: [{
            ttl: 10,
            type: "A"
        }],
        routingPolicy: "MULTIVALUE"
    }
});

let myAppFargateService = new awsx.ecs.FargateService("myApp", {
    ...
    serviceRegistries: {
        registryArn: myServiceRegistry.arn,
        containerName: myAppServiceRegistryService
    }
});

new awsx.ecs.FargateService("myOtherService", {
    ...
    taskDefinitionArgs: {
        containers: {
            [`${serviceName}`]: {
                environment: [{
                    name: "APP_HOSTNAME",
                    value: aws.servicediscovery.Service.get(myAppFargateService.name, myAppFargateService.id)
                }]
            }
        }
    }
});
what I’m trying to looks more or less like this ☝️
c
I that's prolly how I would do it first round. Not sure if you need to wrap that in an
Output.All().Apply()
or not, that you may have to mess with on the the
pulumi preview
.