Configuration

Domain Mapping in AWS

Creating Target Group 

To create a Target Group and Register them with target instances, complete the following steps: 

  1. Go to Target Groups → Create Target Group.

    image 11
  2. Select the below-required details Choose a target type - Instance.
  3. Target Group Name - Give a Name to the target group Protocol and Port - Select the Protocol and Port VPC - Select the VPC.
    image 22
  4. Click Next to register the targets to the created Target Group.
  5. Select the Target Group where you want to register the targets and click on Targets.
    image 33
  6. Click on Register Targets.
    image 44
  7. Select the instance from the list of instances and Click on Register.

    image 55

Creating Load Balancer

To create a Load Balancer and add the target groups for the load balancer, complete the following steps:

  1. Go to Load Balancer→ Click on Create Load Balancer.
    image 66
  2. Select Application Load Balancer And click on create.
    image 77
    1. Give the below-required details and click on Create.
    2. Load BalancerName - Name of Load BalancerScheme - Internet-facing or Internal.
    3. IP address type - IPv4
    4. VPC - Select the VPC where you want to use the Load BalancerAZ’s - Select the AZ where you want to use this Load Balancer For Security Group - Select the Security Group.
    5. Listen - Add a listener(443 is recommended as we use https traffic mostly)
    6. Target Groups - Select the target group where the target instances are registered and click on create the Load Balancer to create the Load balancer.
      image 88

4.      Once the Load Balancer Is created, add the certificates and edit the rules as per requirement.

Registering a Domain with Route53

 In AWS we use Route53 service to buy domains, as shown in the below screenshots.

  1. Go to Route53 → Click on Register.
    image 99
  2. Enter the domain of your choice and click on check to check the availability of the domain.
    image 101
  3. Choose the available domain and click on continue to proceed with the payment options.
    image 102
  4. Use the domain ovaledge.com to map it to the resource where the application is being hosted.

Mapping a Domain Record to Resource in AWS

  1. To map a resource to a domain, create the record in the hosted zone.
  2. Go to Route53 → Hosted Zones.
  3. image 103
  4. Select the domain where you want to create a record.
    image 104
  5. Click on create record or select the existing record if you want to add a resource to the existing record and click edit record.
    image 106
  6. After clicking on the Edit record, add the Record type and Value fields. Record Type - Select A record as we are routing traffic to ipv4 address or ELB Value - Give the ipv4 address or ELB.
    image 107
  7. When the DNS name is entered in the browser, it gets routed to the endpoint or ipv4 that we give in the value field.

Creating a Certificate from AWS ACM

  1. Go to ACM → Click on Request.
    image 108
  2. Select Request a Public Certificate and click on Next.
    image 109
  3. Give the below-required details and click on Request.
  4. FQDN - Give the FQDN for which you want to generate the certificate. 
  5. DNS Validation - Check the DNS validation.
  6. Add a tag name and click on Request to create a certificate.
    image 111-1
  7. Once the Domain and Certificate are created, map it to the ELB to make use of DNS and certificate.

 Adding the certificate to the ELB

  1. Go to Load balancers, select the Load Balancer that you want to add certificates for, and click on Listeners.
    image last 6
  2. Click on view/edit certificates → Select the correct certificate that you want to map to this Load Balancer and click on Ok.
    image last 5

Routing the traffic to correct resources (Adding rules to ELB)

  1. Now select View/edit rules to edit the routing rules.
    image last 4
  2. As shown in the below screenshot, this elb accepts the traffic on 443 and forwards it to “app1-ovaledge-net-tg” target group. This target group may contain one or more instances running the same kind of application and listening on the same port registered to it.
    image last 3
  3. For Load Balancer to route traffic to other target groups, click on + icon → Insert rule.
    image last 2
  4. Define the rule condition, i.e., add a Condition and an Action to carry out if the condition is matched and click on Save to save the condition.

image last 1