We have hosted node js application in elastic beanstalk on AWS environment. We want to check the historical console log of node js. So that we are downloading the logs from Elastic beanstalk application, but it's not containing the historical console log. As we AWS environment hosting is new to us can anybody guide me how to retrieve those historical logs from aws?
When you recycle your instances all the content of the instances is deleted. For that reason you need to copy the logs out of your instance. Amazon has cloudwatch logs where you can feed all the logs from all your servers. http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html
I find a bit confusing the process to set it up with beanstalk. I wrote a post on how to do it for a php application: http://www.albertsola.pro/store-aws-beanstalk-symfony-and-apache-logs-in-cloudwatch-logs/
Related
I have an Elastic Beanstalk instance that is running a Flask app. I want to know if there is any way through AWS to automatically block IP addresses that are doing unusual activity on my site.
This could be a range of things, for example:
Send several GET requests over and over
Trying to POST without a CSRF
And more. Any ideas? Thanks.
Generally, for that you would front your EB with application load balancer and AWS Web Application Firewall.
This setup is documented in the recent AWS blog and other sources:
How do I protect my Elastic Beanstalk environment against attacks from known unwanted hosts?
Setting up AWS Web Application Firewall (WAF) with Elastic Beanstalk
Guidelines for Implementing AWS WAF
I am currently using AWS Elastic Beanstalk to host a web application. I found that I can get logs for my running EC2 instances through the Elastic Beanstalk console. These logs contain detailed information such as web/app server logs etc.
If I am not working with Elastic Beanstalk and I create the resources needed to run my web app without using Elastic Beanstalk, is it possible to get the same type of logs in the picture above? Logs which show web/app server logs. I tried clicking on the EC2 instace -> instance settings -> get system logs, although this does not return the detailed logs which I receive from the Elastic Beanstalk console, as you can see below.
Is it possible to get this type of EC2 logs, if I am not using beanstalk?
Unfortunately you can't, at least not out of the box. There is a special log collector script that runs on EB environments to grab those logs, which I don't think is open source or available on Github (unlike the EKS or ECS log collectors).
I am currently using an AWS Lightsail with a Bitnami image to host a website for searching donors. I would like to enable logging of the IP addresses of users that use the website. I am not sure how to connect to existing AWS services like Cloudwatch to log these accesses, however. Is there a way to integrate the logs or will I need to manually read the server logs via ssh from the Lightsail instance itself?
I would say you would have to manually read it from application logs. This is not available via cloudwatch.
I am trying to deploy an application revision to an existing aws instance using eb deploy, and I've spent several days browsing Amazon's documentation as well as well as related web articles including stack overflow questions and answers, to no avail. The problem is that I can't figure out how to specify the cname to which the application should be deployed. I'm a newbie so any help will be gratefully appreciated.
Your elastic beanstalk environment, where you deployed your revision has a url assigned to it. You can check it in AWS console, or querying your environment in AWS CLI. If you have one instance only, this url will point to your instance. If you have more than one instance in your environment the url will point to your environment elastic load balancer. It does'n matter. In each case, the url will be the same.
Create an CNAME record to point to elastic beanstalk environment url. It will work fine. Even better, if you use the AWS route53 service you can create an Alias record that has some advantages if all your services are across AWS environment.
I keep killing the default instance and it keeps coming back. Why?
This answer is based on the assumption that you are facing a specific issue I've seen several users stumbling over, but your question is a bit short on detail, so I might misinterpret your problem in fact.
Background
The AWS Toolkit for Visual Studio allows you to deploy applications to AWS Elastic Beanstalk, which is a Platform as a Service (PaaS) offering allowing you to quickly deploy and manage applications in the AWS cloud:
You simply upload your application, and Elastic Beanstalk
automatically handles the deployment details of capacity provisioning,
load balancing, auto-scaling, and application health monitoring.
You deploy an application to Elastic Beanstalk into an Environment comprised of an Elastic Load Balancer and resp. Auto Scaling policies, which together ensure your application will keep running even if the EC2 instance is having trouble servicing the requests for whatever reason (see Architectural Overview for an explanation and illustration how these components work together).
That is, your Amazon EC2 instances are managed by default, so you don't need to administrate the infrastructure yourself, but the specific characteristic of this AWS PaaS variation is that you still can do that:
At the same time, with Elastic Beanstalk, you retain full control over
the AWS resources powering your application and can access the
underlying resources at any time.
Now that's exactly what you unintentionally did by terminating the EC2 instance via a mechanism outside of the Elastic Beanstalk service, which the load balancer detects and, driven by those auto scaling policies, triggers the creation of a replacement instance.
Solution
Long story short, you need to terminate the Elastic Beanstalk environment instead, as illustrated in section Step 6: Clean Up within the AWS Elastic Beanstalk Walkthrough (there is a dedicated section for the Elastic Beanstalk service within the AWS Management Console).
You can also do this via Visual Studio, as explained in step 11 at the bottom of How to Deploy the PetBoard Application Using AWS Elastic Beanstalk:
To delete the deployment, expand the Elastic Beanstalk node in AWS
Explorer, and then right-click the subnode for the deployment. Click
Delete. AWS Elastic Beanstalk will begin the deletion process, which
may take a few minutes. If you specified an notification email address
the deployment, AWS Elastic Beanstalk will send status notifications
for the delete process to this address.