• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

securitywing

Menu
  • About
  • Must Read
      • IIS Performance Boost
      • RFID Security
      • Web App Security Testing
      • How to Secure Home Network
      • Prevent Cross-Site Scripting Attacks
      • Renew Self-Signed Certificates
      • Penetration Testing Tools
      • VPN Concentrator
      • Forensic Investigation Tools
      • Digital Certificates
      • Cloud Security Issues
      • Advanced Evasion Prevention
      • Firewall Types
      • Tips to Prevent Data Exfiltration
      • Classified Info Handling
      • MySQL Security
      • Definition of 7 Types of Malware
      • VOIP Security
      • Why Antivirus Software Fails
      • 15 Network Security Vulnerabilities
      • Web App Security
      • IT Security Standards
      • Types of Virtualization
      • Android Security
      • Digital Signature
      • Advanced Malware Protection
    • Close
  • Consultancy
  • Contact

How to Setup a Maintenace Page Message in AWS ALB

by wing

AWS application load balaner supports setting up a custom response for specific domain. If you need a easier method to serve a maintnace message from ALB you need to inject  a new rule with fixed response. The fixed response can be a 5xx status code wtih custom html. To add a custom rule using AWS CLI, you need to have AWS CLI installed with the right permission and need  to create a couple of JSON files such as one for creating a new listener ule and another one to delete the rule when you are done with the website maintenace.

Step 1: create a directory and the following two files:

  • actions-fixed-response.json
  • conditions-pattern.json
 

Add the below code to the  actions-fixed-response.json file. Make sure to update the content of your ALB fixed response message for the maintenace page.

[
    {
        “Type”: “fixed-response”,
        “FixedResponseConfig”: {
            “MessageBody”: “<htlm> <h1>This site is currently under maintenance </h1> </html>”,
            “StatusCode”: “503”,
            “ContentType”: “text/html”
        }
    }
]

 

The contents for the conditions-pattern.json will be as below. Replace the domain name to match your custom domain name.

[
    {
        “Field”: “host-header”,
        “HostHeaderConfig”: {
            “Values”: [
                “*.mywebsite.com”
            ]
        }
    }
]

 

Step 2: take a note of your listener ARN that you need adding the rule to and run the command below:

aws elbv2 create-rule --listener-arn <listener arn>  --priority 5 --conditions file://conditions-pattern.json --actions file://actions-fixed-response.json
 
Note: replace the listener-arn by your ALB listener arn and take a note of the rule arn that you need when deleting the rule.
 

Step 3: to delete the rule you can run the command below.

aws elbv2 delete-rule --rule-arn <rule-arn>
Note: replace the rule-arn by your custom rule that you noted in step 2.
 
To delete the rule via powershell you can query the exsting rule using “–query” and delete the rule as shown
below:

$rulearn = (aws elbv2  describe-rules –listener-arn <listener-arn>  –query Rules[0].RuleArn)
aws elbv2 delete-rule –rule-arn $rulearn
Note: replace the listener-arn by your ALB’s listerner arn

Related Posts:

  • No Related Posts

Filed Under: AWS

Primary Sidebar

CISSP Sample Test

Take a CISSP Sample Test

CISA IT governance Sample test



Twitter Follow @securitywing

Categories

  • AWS
  • containers
  • Internet Security and Safety
  • IS Audit
  • IT Security Exams
  • Network Security Tips
  • Off Track
  • Telecom
  • Tutorial

Pages

  • About
  • Best IT Security Certification Exam
  • CISA IT governance Sample test
  • CISA Sample Test
  • CISSP Sample Test Online
  • Consultancy
  • Contact

Popular Posts

  • 3 Steps to Install Miniku...
  • How to install a new Goda...
  • 63 Web Application Securi...
  • How to Setup AWS CloudFro...
  • How to Renew Self-Signed...
  • Host Based IDS vs Network...
  • 8 Effective Ways to Impro...
  • Active vs Passive FTP Mod...
  • Top 10 RFID Security Conc...
  • 3 Simple Steps to Capture...

Footer

Copyrights

Protected by Copyscape Duplicate Content Detection Software

Securitywing.com reserves the copyrights of all of its published articles.No contents of this site is permitted to be published to anywhere else in the Internet.If any contents are found in any other websites, securitywing reserves the rights to file a DMCA complaint. But you have the right to use the link of any relevant article of this site to point from your website if you consider that it might improve the quality of your article.

Tags

antivirus audit AWS backup browser check cisco cloud computer cyber data database encryption firewall home hsrp ids informaiton internet intrusion it kubernetes linux load balancing malware network protection putty risk router security security tips server ssh SSL switch tools virus vpn vulnerability web webserver website windows wordpress

Copyright © 2010-2023 ·All Rights Reserved · SecurityWing.com