How to deploy Netfilex Eureka Server and Eureka Client with docker Network on AWS ECS cluster
I am migrating my spring cloud eureka application to AWS ECS and currently having some trouble doing so.
I have an ECS cluster on AWS in which two EC2 services was created
- Eureka-server
- Eureka-client
each service has a Task running on it.
QUESTION:
how do i establish a "docker network" amongst these two services such that i can register my eureka-client to the eureka-server's registry? Having them in the same cluster doesn't seem to do the trick.
locally i am able to establish a "docker network" to achieve this task. is it possible to have a "docker network" on AWS?
amazon-ec2 amazon-ecs netflix-eureka spring-cloud-netflix
add a comment |
I am migrating my spring cloud eureka application to AWS ECS and currently having some trouble doing so.
I have an ECS cluster on AWS in which two EC2 services was created
- Eureka-server
- Eureka-client
each service has a Task running on it.
QUESTION:
how do i establish a "docker network" amongst these two services such that i can register my eureka-client to the eureka-server's registry? Having them in the same cluster doesn't seem to do the trick.
locally i am able to establish a "docker network" to achieve this task. is it possible to have a "docker network" on AWS?
amazon-ec2 amazon-ecs netflix-eureka spring-cloud-netflix
add a comment |
I am migrating my spring cloud eureka application to AWS ECS and currently having some trouble doing so.
I have an ECS cluster on AWS in which two EC2 services was created
- Eureka-server
- Eureka-client
each service has a Task running on it.
QUESTION:
how do i establish a "docker network" amongst these two services such that i can register my eureka-client to the eureka-server's registry? Having them in the same cluster doesn't seem to do the trick.
locally i am able to establish a "docker network" to achieve this task. is it possible to have a "docker network" on AWS?
amazon-ec2 amazon-ecs netflix-eureka spring-cloud-netflix
I am migrating my spring cloud eureka application to AWS ECS and currently having some trouble doing so.
I have an ECS cluster on AWS in which two EC2 services was created
- Eureka-server
- Eureka-client
each service has a Task running on it.
QUESTION:
how do i establish a "docker network" amongst these two services such that i can register my eureka-client to the eureka-server's registry? Having them in the same cluster doesn't seem to do the trick.
locally i am able to establish a "docker network" to achieve this task. is it possible to have a "docker network" on AWS?
amazon-ec2 amazon-ecs netflix-eureka spring-cloud-netflix
amazon-ec2 amazon-ecs netflix-eureka spring-cloud-netflix
edited Nov 21 '18 at 7:53
DJ_
asked Nov 21 '18 at 7:08
DJ_DJ_
265
265
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The problem here lies on the way how ECS clusters work. If you go to your dashboard and check out your task definition, you'll see an ip address which AWS assigns to the resource automatically.
In Eureka's case, you need to somehow obtain this ip address while deploying your eureka client apps and use it to register to your eureka-server. But of course your task definitions gets destroyed and recreated again somehow so you easily lose it.
I've done this before and there are couple of ways to achieve this. Here is one of the ways:
- For the EC2 instances that you intend to spread ECS tasks as eureka-server or registry, you need to assign Elastic IP Addresses so you always know where to connect to in terms of a host ip address.
- You also need to tag them properly so you can refer them in the next step.
- Then switching back to ECS, when deploying your eureka-server tasks, inside your task definition configuration, there's an argument as
placement_constraint
This will allow you to add a tag to your tasks so you can place those in the instances you assigned elastic ip addresses in the previous steps. - Now if this is all good and you deployed everything, you should be able to refer your eureka-client apps to that ip and have them registered.
I know this looks dirty and kind of complicated but the thing is Netflix OSS project for Eureka has missing parts which I believe is their proprietary implementation for their internal use and they don't want to share.
Another and probably a cooler way of doing this is using a Route53 domain or alias record for your instances so instead of using an elastic ip, you can also refer them using a DNS.
Thank you for the reply! i will try the elastic IP method and see if it works. Just to clarify. meaning i will need to sort of "hard code" the elastic IP of my registry into my clients for recognition? i found another article about service discovery but so far no luck in implementing this yet 040code.github.io/2018/02/14/service-discovery
– DJ_
Nov 23 '18 at 7:27
how should i add the task placement? i first tagged my elastic IP as using Key Value Pair where Key is Name and Value is eureka-server but under Task Definition i can't seem to access this Key value pair. How should i type it exactly?
– DJ_
Nov 23 '18 at 8:12
Yes, this blogger also went on a similar path as I faced. You can also export that ip and port to make it work just like that and then inject that to your spring app through either environment variables or application properties. Give these a try and let me know.
– neocorp
Nov 23 '18 at 8:14
It doesn't work like that. To use that information, you need use a language similar to sql which will allow you to define a specific instance for your tasks. Check out this doc from Amazon : docs.aws.amazon.com/AmazonECS/latest/developerguide/…
– neocorp
Nov 23 '18 at 8:16
thank you for the reply! manged to do it using the elastic IP mehtod :)
– DJ_
Nov 27 '18 at 6:05
|
show 1 more comment
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53406890%2fhow-to-deploy-netfilex-eureka-server-and-eureka-client-with-docker-network-on-aw%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem here lies on the way how ECS clusters work. If you go to your dashboard and check out your task definition, you'll see an ip address which AWS assigns to the resource automatically.
In Eureka's case, you need to somehow obtain this ip address while deploying your eureka client apps and use it to register to your eureka-server. But of course your task definitions gets destroyed and recreated again somehow so you easily lose it.
I've done this before and there are couple of ways to achieve this. Here is one of the ways:
- For the EC2 instances that you intend to spread ECS tasks as eureka-server or registry, you need to assign Elastic IP Addresses so you always know where to connect to in terms of a host ip address.
- You also need to tag them properly so you can refer them in the next step.
- Then switching back to ECS, when deploying your eureka-server tasks, inside your task definition configuration, there's an argument as
placement_constraint
This will allow you to add a tag to your tasks so you can place those in the instances you assigned elastic ip addresses in the previous steps. - Now if this is all good and you deployed everything, you should be able to refer your eureka-client apps to that ip and have them registered.
I know this looks dirty and kind of complicated but the thing is Netflix OSS project for Eureka has missing parts which I believe is their proprietary implementation for their internal use and they don't want to share.
Another and probably a cooler way of doing this is using a Route53 domain or alias record for your instances so instead of using an elastic ip, you can also refer them using a DNS.
Thank you for the reply! i will try the elastic IP method and see if it works. Just to clarify. meaning i will need to sort of "hard code" the elastic IP of my registry into my clients for recognition? i found another article about service discovery but so far no luck in implementing this yet 040code.github.io/2018/02/14/service-discovery
– DJ_
Nov 23 '18 at 7:27
how should i add the task placement? i first tagged my elastic IP as using Key Value Pair where Key is Name and Value is eureka-server but under Task Definition i can't seem to access this Key value pair. How should i type it exactly?
– DJ_
Nov 23 '18 at 8:12
Yes, this blogger also went on a similar path as I faced. You can also export that ip and port to make it work just like that and then inject that to your spring app through either environment variables or application properties. Give these a try and let me know.
– neocorp
Nov 23 '18 at 8:14
It doesn't work like that. To use that information, you need use a language similar to sql which will allow you to define a specific instance for your tasks. Check out this doc from Amazon : docs.aws.amazon.com/AmazonECS/latest/developerguide/…
– neocorp
Nov 23 '18 at 8:16
thank you for the reply! manged to do it using the elastic IP mehtod :)
– DJ_
Nov 27 '18 at 6:05
|
show 1 more comment
The problem here lies on the way how ECS clusters work. If you go to your dashboard and check out your task definition, you'll see an ip address which AWS assigns to the resource automatically.
In Eureka's case, you need to somehow obtain this ip address while deploying your eureka client apps and use it to register to your eureka-server. But of course your task definitions gets destroyed and recreated again somehow so you easily lose it.
I've done this before and there are couple of ways to achieve this. Here is one of the ways:
- For the EC2 instances that you intend to spread ECS tasks as eureka-server or registry, you need to assign Elastic IP Addresses so you always know where to connect to in terms of a host ip address.
- You also need to tag them properly so you can refer them in the next step.
- Then switching back to ECS, when deploying your eureka-server tasks, inside your task definition configuration, there's an argument as
placement_constraint
This will allow you to add a tag to your tasks so you can place those in the instances you assigned elastic ip addresses in the previous steps. - Now if this is all good and you deployed everything, you should be able to refer your eureka-client apps to that ip and have them registered.
I know this looks dirty and kind of complicated but the thing is Netflix OSS project for Eureka has missing parts which I believe is their proprietary implementation for their internal use and they don't want to share.
Another and probably a cooler way of doing this is using a Route53 domain or alias record for your instances so instead of using an elastic ip, you can also refer them using a DNS.
Thank you for the reply! i will try the elastic IP method and see if it works. Just to clarify. meaning i will need to sort of "hard code" the elastic IP of my registry into my clients for recognition? i found another article about service discovery but so far no luck in implementing this yet 040code.github.io/2018/02/14/service-discovery
– DJ_
Nov 23 '18 at 7:27
how should i add the task placement? i first tagged my elastic IP as using Key Value Pair where Key is Name and Value is eureka-server but under Task Definition i can't seem to access this Key value pair. How should i type it exactly?
– DJ_
Nov 23 '18 at 8:12
Yes, this blogger also went on a similar path as I faced. You can also export that ip and port to make it work just like that and then inject that to your spring app through either environment variables or application properties. Give these a try and let me know.
– neocorp
Nov 23 '18 at 8:14
It doesn't work like that. To use that information, you need use a language similar to sql which will allow you to define a specific instance for your tasks. Check out this doc from Amazon : docs.aws.amazon.com/AmazonECS/latest/developerguide/…
– neocorp
Nov 23 '18 at 8:16
thank you for the reply! manged to do it using the elastic IP mehtod :)
– DJ_
Nov 27 '18 at 6:05
|
show 1 more comment
The problem here lies on the way how ECS clusters work. If you go to your dashboard and check out your task definition, you'll see an ip address which AWS assigns to the resource automatically.
In Eureka's case, you need to somehow obtain this ip address while deploying your eureka client apps and use it to register to your eureka-server. But of course your task definitions gets destroyed and recreated again somehow so you easily lose it.
I've done this before and there are couple of ways to achieve this. Here is one of the ways:
- For the EC2 instances that you intend to spread ECS tasks as eureka-server or registry, you need to assign Elastic IP Addresses so you always know where to connect to in terms of a host ip address.
- You also need to tag them properly so you can refer them in the next step.
- Then switching back to ECS, when deploying your eureka-server tasks, inside your task definition configuration, there's an argument as
placement_constraint
This will allow you to add a tag to your tasks so you can place those in the instances you assigned elastic ip addresses in the previous steps. - Now if this is all good and you deployed everything, you should be able to refer your eureka-client apps to that ip and have them registered.
I know this looks dirty and kind of complicated but the thing is Netflix OSS project for Eureka has missing parts which I believe is their proprietary implementation for their internal use and they don't want to share.
Another and probably a cooler way of doing this is using a Route53 domain or alias record for your instances so instead of using an elastic ip, you can also refer them using a DNS.
The problem here lies on the way how ECS clusters work. If you go to your dashboard and check out your task definition, you'll see an ip address which AWS assigns to the resource automatically.
In Eureka's case, you need to somehow obtain this ip address while deploying your eureka client apps and use it to register to your eureka-server. But of course your task definitions gets destroyed and recreated again somehow so you easily lose it.
I've done this before and there are couple of ways to achieve this. Here is one of the ways:
- For the EC2 instances that you intend to spread ECS tasks as eureka-server or registry, you need to assign Elastic IP Addresses so you always know where to connect to in terms of a host ip address.
- You also need to tag them properly so you can refer them in the next step.
- Then switching back to ECS, when deploying your eureka-server tasks, inside your task definition configuration, there's an argument as
placement_constraint
This will allow you to add a tag to your tasks so you can place those in the instances you assigned elastic ip addresses in the previous steps. - Now if this is all good and you deployed everything, you should be able to refer your eureka-client apps to that ip and have them registered.
I know this looks dirty and kind of complicated but the thing is Netflix OSS project for Eureka has missing parts which I believe is their proprietary implementation for their internal use and they don't want to share.
Another and probably a cooler way of doing this is using a Route53 domain or alias record for your instances so instead of using an elastic ip, you can also refer them using a DNS.
answered Nov 22 '18 at 20:58
neocorpneocorp
349515
349515
Thank you for the reply! i will try the elastic IP method and see if it works. Just to clarify. meaning i will need to sort of "hard code" the elastic IP of my registry into my clients for recognition? i found another article about service discovery but so far no luck in implementing this yet 040code.github.io/2018/02/14/service-discovery
– DJ_
Nov 23 '18 at 7:27
how should i add the task placement? i first tagged my elastic IP as using Key Value Pair where Key is Name and Value is eureka-server but under Task Definition i can't seem to access this Key value pair. How should i type it exactly?
– DJ_
Nov 23 '18 at 8:12
Yes, this blogger also went on a similar path as I faced. You can also export that ip and port to make it work just like that and then inject that to your spring app through either environment variables or application properties. Give these a try and let me know.
– neocorp
Nov 23 '18 at 8:14
It doesn't work like that. To use that information, you need use a language similar to sql which will allow you to define a specific instance for your tasks. Check out this doc from Amazon : docs.aws.amazon.com/AmazonECS/latest/developerguide/…
– neocorp
Nov 23 '18 at 8:16
thank you for the reply! manged to do it using the elastic IP mehtod :)
– DJ_
Nov 27 '18 at 6:05
|
show 1 more comment
Thank you for the reply! i will try the elastic IP method and see if it works. Just to clarify. meaning i will need to sort of "hard code" the elastic IP of my registry into my clients for recognition? i found another article about service discovery but so far no luck in implementing this yet 040code.github.io/2018/02/14/service-discovery
– DJ_
Nov 23 '18 at 7:27
how should i add the task placement? i first tagged my elastic IP as using Key Value Pair where Key is Name and Value is eureka-server but under Task Definition i can't seem to access this Key value pair. How should i type it exactly?
– DJ_
Nov 23 '18 at 8:12
Yes, this blogger also went on a similar path as I faced. You can also export that ip and port to make it work just like that and then inject that to your spring app through either environment variables or application properties. Give these a try and let me know.
– neocorp
Nov 23 '18 at 8:14
It doesn't work like that. To use that information, you need use a language similar to sql which will allow you to define a specific instance for your tasks. Check out this doc from Amazon : docs.aws.amazon.com/AmazonECS/latest/developerguide/…
– neocorp
Nov 23 '18 at 8:16
thank you for the reply! manged to do it using the elastic IP mehtod :)
– DJ_
Nov 27 '18 at 6:05
Thank you for the reply! i will try the elastic IP method and see if it works. Just to clarify. meaning i will need to sort of "hard code" the elastic IP of my registry into my clients for recognition? i found another article about service discovery but so far no luck in implementing this yet 040code.github.io/2018/02/14/service-discovery
– DJ_
Nov 23 '18 at 7:27
Thank you for the reply! i will try the elastic IP method and see if it works. Just to clarify. meaning i will need to sort of "hard code" the elastic IP of my registry into my clients for recognition? i found another article about service discovery but so far no luck in implementing this yet 040code.github.io/2018/02/14/service-discovery
– DJ_
Nov 23 '18 at 7:27
how should i add the task placement? i first tagged my elastic IP as using Key Value Pair where Key is Name and Value is eureka-server but under Task Definition i can't seem to access this Key value pair. How should i type it exactly?
– DJ_
Nov 23 '18 at 8:12
how should i add the task placement? i first tagged my elastic IP as using Key Value Pair where Key is Name and Value is eureka-server but under Task Definition i can't seem to access this Key value pair. How should i type it exactly?
– DJ_
Nov 23 '18 at 8:12
Yes, this blogger also went on a similar path as I faced. You can also export that ip and port to make it work just like that and then inject that to your spring app through either environment variables or application properties. Give these a try and let me know.
– neocorp
Nov 23 '18 at 8:14
Yes, this blogger also went on a similar path as I faced. You can also export that ip and port to make it work just like that and then inject that to your spring app through either environment variables or application properties. Give these a try and let me know.
– neocorp
Nov 23 '18 at 8:14
It doesn't work like that. To use that information, you need use a language similar to sql which will allow you to define a specific instance for your tasks. Check out this doc from Amazon : docs.aws.amazon.com/AmazonECS/latest/developerguide/…
– neocorp
Nov 23 '18 at 8:16
It doesn't work like that. To use that information, you need use a language similar to sql which will allow you to define a specific instance for your tasks. Check out this doc from Amazon : docs.aws.amazon.com/AmazonECS/latest/developerguide/…
– neocorp
Nov 23 '18 at 8:16
thank you for the reply! manged to do it using the elastic IP mehtod :)
– DJ_
Nov 27 '18 at 6:05
thank you for the reply! manged to do it using the elastic IP mehtod :)
– DJ_
Nov 27 '18 at 6:05
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53406890%2fhow-to-deploy-netfilex-eureka-server-and-eureka-client-with-docker-network-on-aw%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown