Hi, what's the best way to find the service IP fro...
# general
c
Hi, what's the best way to find the service IP from this code? I'm not using a LB because it's an internal API. :
Copy code
export const fargate = new awsx.ecs.FargateService(NAME, {
  cluster,
  taskDefinitionArgs: {
    containers: {
      mbankrlproxy: {
        image: image,
        memory: 512,
        portMappings: [{ containerPort: 80, hostPort: 80 }],
        environment: ENVIRONMENT,
      },
    },
  },
  desiredCount: 1,
});
The cluster->task->container is then given a Public and Private IP (I can see this on AWS consile). How do I access these IP's from the awsx API?
b
not at my computer but usually with these kinds of problems, i export the entire resource at the end of my index.ts.
then pulumi preview and see if i can trace down how to fetch the specific thing im looking for
g
@clean-salesclerk-32849 Unfortunately, public nor private IP addresses are a part of AWS
DescribeServices
endpoint response, so it's not available as you're trying to get above. I'm assuming this is because ENIs given to fargate services are likely to change.
c
@green-stone-37839 No problem. AWS isn't my wheelhouse. Is there another API to get them? Or can I assign a static IP? Just need to connect service to consumer. What's best practice?
g
The most common scenario is assigning the service to a load balancer and serving content from there. Who is the consumer in this case?
c
@green-stone-37839 it's an internal service for some other AWS EC2 instances. It shouldn't have an external IP, by maybe it was assigned one because I specified a public subnet.
g
internal or not, using the IP address of the service/task is going to cause problems for you when the service/task inevitably changes IP addresses.
👍 1
c
Legit.
g
I'd suggest using a load balancer or ECS Service Discovery although load balancer is by far the simpler option.
c
Is there a way to specify the IP?
Doesn't loadbalancer have a gateway to the internet? It's a singleton service that shouldn't scale.
g
an internal load balancer won't. Also, with Fargate you cannot assign a static or Elastic IP
👍 1
c
Ok, sounds like a start. Thank you Phillip, have a great week!
g
you too!