Currently, ALB is placed on AWS and one EC2 is placed below it.
(The reason for placing ALB is because WAF is set on ALB.)
EC2 is a web/AP server, and users who use services within EC2 connect externally via https (via ALB).
The EC2 operating hours are 8: 00-20: 00 every day
(Scheduled by Lambda/cloudwatch)
In this configuration, I want to automatically display the screen when the server (service) is stopped for users connecting from outside between 20:00 and 8:00 (while EC2 is stopped). I don't know how.
EC2->Load balancer->ALB->"View/edit rules" for listeners
So, I was wondering what to do when EC2 returns 503,
I did not know exactly what value to achieve.
Sorry for your understanding, thanks for your professor
Answer # 1
This is an automated method of "display a stop screen when the service is down"
Since each method is different, the time required for switching is quite different.
Which is better is difficult, but Route 53 is easier, so I think you should consider this first.
(1) Use Route53 DNS Failover
・ Switches to the stop screen server when Route53 goes down while monitoring ALB.
・ Since it is switching by DNS, it is affected by TTL after switching.
・ A web server for the stop screen is required (S3 static website is OK)
(2) Cloudwatch Alarm->Lambda
-Monitor service stoppage with Cloudwatch (Example: Alarm is activated when HealthyHostCount = 0)
* Cloudwatch monitoring interval is 5 minutes
・ Cloudwatch Alarm->SNS Topics->Cooperation with Lambda
・ Lambda code uses API to change ALB settings and switch.
It is better to register two listener rules in advance (for normal time and for stop time), and change the priority by changing the priority with the API.
・ Priority 1: IF all transferred to THEN target group
・ Priority 2: IF, all return the stop screen with THEN fixed response
・ Priority 1: IF all, return stop screen with THEN fixed response
・ Priority 2: Transfer all IF to THEN target group
You can change the priority with SetRulePriorities.
Answer # 2
If you are using ALB, you can manipulate the response contents with just ALB.
This article on the class method blog might be helpful
In this case, I think that the purpose is to "transition to a page that knows when the server is intentionally dropped".
So, should we return a response that tells us that it's intentional that we can't connect to the service?
If "Transition to error page at error response" is used, it cannot be determined whether the failure to connect to the service is intentional or due to a failure.
Answer # 3
It is better to use CloudFront's Custom Error Response, as in this article on class methods.
The page is automatically displayed when switching, and the domain can be set the same as ALB.
- aws - about aws cloudformation coding
- aws - internal server error 500 when running lambda from api
- aws - how to output as character code `` shift_jis '' with amazon aws lambda @ edge (nodejs)
- aws - ideal server for small-scale ec site small start of large-capacity digital products
- aws - after terraform apply, an error occurred and the command could not be hit
- aws - aws iot-> data transmission to sakuraio
- aws - i want to deploy some lambda functions in other regions
- aws - i want to know how to grant support inquiry to my aws account
- aws - i want to be able to log in with both username and email with cognito created from amplify-cli
- aws - aws lightsail's wordpress does not recognize its own domain
- aws - i want to calculate the processing time on aws
- aws - ssh login fails with aws
- aws - i don't know how to save lightsail with cron editor
- aws - aws:about server construction
- aws - after pushing the source to the remote of git, when i clone it locally, there is a difference in the source
- aws - every time when uploading laravel application with aws codedeploy, error occurs in env
- aws - i want to pull docker image with aws cli (no basic auth credential error)
- aws - is there a way to exclude the "aws-sdk" module when deploying to lambda from cloud9?
- aws - aws authentication error for serverless framework
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- python - you may need to restart the kernel to use updated packages error
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- xcode - pod install [!] no `podfile 'found in the project directory
- vuejs - [vuetify] unable to locate target [data-app] i want to unit test to avoid warning
- i want to call a child component method from a parent in vuejs