https://pulumi.com logo
#general
Title
# general
c

clean-salesclerk-32849

09/13/2022, 2:47 PM
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

breezy-airplane-94478

09/13/2022, 7:53 PM
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

green-stone-37839

09/13/2022, 10:04 PM
@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

clean-salesclerk-32849

09/13/2022, 10:11 PM
@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

green-stone-37839

09/13/2022, 10:30 PM
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

clean-salesclerk-32849

09/13/2022, 10:33 PM
@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

green-stone-37839

09/13/2022, 10:34 PM
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

clean-salesclerk-32849

09/13/2022, 10:35 PM
Legit.
g

green-stone-37839

09/13/2022, 10:35 PM
I'd suggest using a load balancer or ECS Service Discovery although load balancer is by far the simpler option.
c

clean-salesclerk-32849

09/13/2022, 10:35 PM
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

green-stone-37839

09/13/2022, 10:37 PM
an internal load balancer won't. Also, with Fargate you cannot assign a static or Elastic IP
👍 1
c

clean-salesclerk-32849

09/13/2022, 10:38 PM
Ok, sounds like a start. Thank you Phillip, have a great week!
g

green-stone-37839

09/13/2022, 10:38 PM
you too!