Home > Blockchain >  Best practice to keep the domain/url for loadbalancer
Best practice to keep the domain/url for loadbalancer

Time:03-03

I am using cdk to deploy fargate and loadbalancer system.

Every time I deploy by cdk the url and global IP is made such as

cdk-ecs-bb-aa-dx-XXXXXX.ap-northeast-1.elb.amazonaws.com
18.714.**.**

However this ip is changed every time cdk destroy and cdk deploy.

Is there any way to keep the same IP?

Or do I need to add some service to keep the IP (like Route 53?)

(If so, how can I keep the same address to regist in DNS)

What is the best practice when using fargate and loadbalancer.

I am not familiar the aws DNS or IP system yet.

Any help is appreciated, thank you very much.

CodePudding user response:

Generally, the approach is to use a CNAME record or Route53 Alias record pointing to the FQDN that is created when you instantiate the load balancer. Application load balancers can't be assigned EIP's, and they will randomly select available IP's from the CIDR ranges in the subnets where they are created. Hence, the best approach, if you have the option, is to utilize the name only when referring to the ALB, and using a friendly CNAME or Route 53 alias to refer to the generated FQDN.

If you have a hard requirement to use static IP's, this can be achieved by front-ending your ALB with either an NLB or Global Accelerator, which would maintain a static IP on the front end, and forward to your dynamically addressed ALB on the back end.

  • Related