location of Amazon Elastic Beanstalk Apache access logs - amazon

I'm digging around trying to find the location of the access logs on an EC2 instance within the beanstalk running PHP5 and not JAVA.
I've looked in /var/log/httpd and the access_log there is empty.
Also the AWS control panel logs don't show the access logs.
Does anyone know where I might be able to get these access logs?

Related

Getting logs of Openshift applications from Nodejs server

I have a Nodejs server which is used to get the logs of a few servers which are sitting on VMs by connecting to the VM via SSH and using the tail command on the log file.
I wanted to know if there is a similar way or any way to get the logs of an app who's container is on openshift and not a VM, and if there is a way to get the logs of all the pods as one.
Thanks
Did you check the OpenShift documentation?
You can install a full EFK stack directly in OCP via an operator and /or forward the logs of everything running in OCP to an external EFK stack
https://docs.okd.io/latest/logging/cluster-logging.html
This works if the logs are written to stdout/stderr in the pods
Here are some other techniques around centralizing logs with kubernetes:
https://kubernetes.io/docs/concepts/cluster-administration/logging/

How to access files deployed in aws elasticbeanstalk

I have deployed node.js code on aws elasticbeanstalk creating a new environment. The app is successfully deployed. I want to access the files. I used ssh to the remote machine but the I can't find the code
Elastic Beanstalk places the deployed code in /var/app/current
Note that you shouldn't be making changes on the Elastic Beanstalk server directly.
Adding to the last answer, remember that you need to select enable SSH to your instances when launching application. Else, you won't be able to SSH into any AWS Elastic Beanstalk instance.
If you found this question but you're not using ssh, you could download the zip after clicking on a version in the console.

How to access nodejs application installed on AWS EC2

I have AWS EC2 with Ubuntu instance. I successfully setup ssh access and I am able to login via ssh console. I installed NodeJS and one simple NodeJS application. Successfully start it by node server.js and when executing curl http://localhost:8080 I can confirm application is up and running. My only issue is that I am not able to access it using provided public IP by AWS.
I can see my public IP from AWS console, and I thought it should be enough to type:
http://aws-public-ip:8080 and it should load the application. It seams I am wrong since I don't obtain access to my app.
Any hints would be appreciated.
Actually I found the answer by myself - I had to edit security group rule and just add rule for corresponding port. By default security group created when you create your instance has only one incoming rule for port 22.

Why Https doesn't work on EC2?

I have a running Elastic Beanstalk instance running on a security group that have http and https authorized in inbound. But https doesnt seems to work... Why?
Second question:
I am currently creating a ssl certificate for my domain name. Where am I supposed to upload it on AWS ?
Thank you
You can configure HTTPS for your Elastic Beanstalk environment.
Please read the following document:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https.html
You can upload your SSL certificate to AWS IAM using the console or CLI whichever you prefer.
You need not modify the security group of the EC2 instance directly.
More details on Step 3 of the documentation above:
Create a file called 01-ssl.config in a folder named .ebextensions inside your app source.
Put the following inside this file.
option_settings:
- namespace: aws:elb:loadbalancer
option_name: LoadBalancerHTTPSPort
value: 443
- namespace: aws:elb:loadbalancer
option_name: SSLCertificateId
value: <arn of your ssl certificate>
These option settings should automatically modify your security group ingress rules to allow traffic appropriately.
You can read more about customizing your Elastic Beanstalk environment using ebextensions here.
Details about all option settings supported including the ELB ones are available here.
Let me know if you run into any issues.
Update
By default when you create an Elastic Beanstalk environment it creates an EC2 instance and puts it behind an Elastic Load Balancer. If you do not need a load balancer then you can create a Single Instance environment as explained here or do you already have a single instance environment.
Once you have a single instance environment you can configure SSL for your environment as explained here.
Update on how to not put your certificate in your config file
Since you do not want to put the server.crt file in your ebextensions config file you can upload your file to S3 and then ask Elastic Beanstalk to download that file directly to your EC2 instance. The only thing that changes in the example here is that you use a source
instead of content to specify the contents of your file. In the source section you can put the URL from where you want the file to be downloaded.
Your ebextensions will then look like:
files:
/etc/pki/tls/certs/server.crt:
mode: "000777"
owner: ec2-user
group: ec2-user
source: <URL>
That way you don't need to put the contents in the repo. Read more about the file directive here.
In case you run into issues double check that your IAM instance profile (the one with which you run your beanstalk environment) has access to your S3 object.
If you need more details about IAM instance roles and Elastic Beanstalk read this and this.

Amazon EC2 IIS-8 User's Permission Write Access

I am using Amazon EC2 using Elastic Beanstalk deployment process through Visual Studio all is working well, except that when the application is deployed it does not have by default write permission; so I had to manually Remote Desktop the individual machine; and give it write permission through IIS site and under permissions.
How can I automate this process, since amazon servers adds on to load balancer using auto-scaling etc.?
Or If I change one, the other to follow will copy the exact same thing, which I had done manually?
I am little confused, first time deploying, please help?
Thanks
Yes, you can use ebextensions config to set permissions on the directory after the instance spins up. Here is an example of someone creating a directory and setting the permissions on the new directory, you should be able to adapt to your circumstances:
AWS Beanstalk ebextensions on windows

Resources