Reputation: 13989
I'm building a slack app, and my application is expected to receive webhook calls from slack. SO I need to give Slack the "endpoint URL for my service"
I'm not sure I understand what AWS bricks I need to put together to make this work. So far, I have configured my service using Fargate and it is running on ECS with 1 task.
I'm not really sure how I can successfully connect the internet (slack) to my container instance. How do I make an "endpoint" that slack can send requests to ? I believe I need to use API Gateway for this, but I'm not sure how I'm supposed to configure API Gateway so it redirect my URLs to my ECS service...?
Notes :
Upvotes: 8
Views: 8006
Reputation: 13989
I'm not sure if there's an alternative or not, but when setting up a service on fargate, in order to receive traffic you will need
For instance, to distribute traffic from a target group, you can use this to configure the service
"loadBalancers": [
{
"containerName": "your-container-name-app",
"containerPort": 80,
"targetGroupArn": "arn:aws:elasticloadbalancing:eu-central-1:account-id:targetgroup/targetgroup-name/RANDOM-ID"
}
],
Create the target group like this
aws elbv2 create-target-group \
--name targetgroup-name \
--protocol HTTP \
--port 80 \
--vpc-id vpc-YOUR_VPC_ID \
--health-check-protocol HTTP \
--health-check-path /healthcheck \
--target-type ip
So you'll basically use the load balancer DNS to route traffic to your instances. Using an ALB, you can easily intercept a certain path (eg /slack/*
) to route to your specific target group, so the same ALB can be used for multiple different services.
But you need a load balancer, and cannot target Fargate containers directly from what I understand.
Upvotes: 6