https://pulumi.com logo
#aws
Title
# aws
s

sparse-intern-71089

09/04/2020, 6:49 PM
This message was deleted.
c

chilly-hairdresser-56259

09/04/2020, 7:49 PM
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

incalculable-portugal-13011

09/05/2020, 12:36 AM
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

chilly-hairdresser-56259

09/05/2020, 2:29 AM
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
.
2 Views