ElasticBeanstalk not working config - client_max_body_size - amazon-web-services

my Enviroment is
ELB platform : Corretto 11 running on 64bit Amazon Linux 2/3.4.2
Application : Spring Boot Jar
so how can edit "client_max_body_size" Amazon Linux 2?
many another stackoverflow Q/A explain this.
create path and file like this
-- .platform
-- nginx
-- conf.d
-- client_max_body_size.conf
and writ "client_max_body_size 256M;" in client_max_body_size.conf
but it is not work...
here is my project structure
What do I have to fix to work properly?

Related

How I can replace customized /etc/nginx/nginx.conf file, when build Elastic Beanstalk from Docker File

Dear network please take a look on following questions.
ENVIRONMENT:
AWS Elastic Beanstalk (EBS) (Docker running on 64bit Amazon Linux 2/3.4.12)
SITUATION:
I am running AWS EBS from Docker Platform and using Docker File to run the container. After deployment I need to replace nginx.conf file with my updated nginx.conf,
ACTIONS:
Trying to use in DockerFile ADD https://my-scripts.s3.amazonaws.com/nginx.conf /etc/nginx command, but after deployment the file isn't replacing the original file.
RESULT:
Seems the reason is, that nginx installing in container after Docker File process and probably to have custom nginx.conf I need to use on of the aws platform
custom hooks.
QUESTIONS:
Am I in the right direction regarding custom hooks, or there are
better ways to solve it?
How platform custom hooks could be used for this case to build EBS:
Should I just add hooks /opt/elasticbeanstalk/hooks/postdeploy
EX: ADD s3://my_custom_hook_script /opt/elasticbeanstalk/hooks/postdeploy.?
As a solution just make war/zip archive with DockerFile and .platform/nginx/nginx.conf and deploy war/zip instead of DockerFile only. That replaced /etc/nginx/nginx.conf and not need to restart nginx. COuld be this meaningfull solution ?
NOTE:
When I was building AWS EBS from war file for my other service, I just added the .platform/nginx/nginx.conf under the root of project and after building war keep that folder in the same level as the generated project jar, which replace with custom nginx.conf without restarting nginx service.
Thanks in advance

Deploy docker container fails on AWS Beanstalk

I have a simple application (docker) that I want to deploy through the AWS beanstalk.
U have a zip arhive with 2 files:
+simple.jar
+Dockerfile
Dockerfile contains these records:
FROM openjdk:11
WORKDIR /usr/app
COPY ./ ./
EXPOSE 80
CMD ["java", "-jar", "simple.jar"]
I am getting this error during dpeloyment
[ERROR] An error occurred during execution of command [app-deploy] - [Run Docker Container]. Stop running the command. Error: open file failed with error open /opt/elasticbeanstalk/deployment/.aws_beanstalk.current-container-id: no such file or directory
local build through "docker build" works and application is available on the port 80.
So I am not sure what to do and how to debug the problem more deeply.
So problem was solved by changing the Platform branch from
"Docker running on 64but Amazon Linux 2" to
"Docker running on 64but Amazon Linux".
It has different versions, but actually why it is not running needs more deep investigation.
I experienced this issue when my deployment had a ".ebextensions" directory. Removing the directory solved the issue.
AWS Notes
On Amazon Linux 2 platforms, instead of providing files and commands in .ebextensions configuration files, we highly recommend that you use Buildfile. Procfile, and platform hooks whenever possible to configure and run custom code on your environment instances during instance provisioning. For details about these mechanisms, see Extending Elastic Beanstalk Linux platforms.

AWS: Create a new environment (tomcat-single-instance): .ebextensions with SSL certificate - fails to start

Elastic Beanstalk: Create a new environment: .ebextensions with SSL certificate fails to start (tomcat-single-instance)
I am trying to create a new environment with the current production WAR package.
New instance deployment fails and comes up with "Green" status. We originally followed this sample to create the .ebextensions (https://s3.amazonaws.com/elasticbeanstalk-single-instance-ssl-demo/tomcat-single-instance.zip) and extended as described here https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-tomcat.html .
New Platform: Managed, Tomcat 8.5 with Java 8 on 64bit Amazon Linux
Platform version: 3.4.1(Recommended)
Error:
httpd24-tools conflicts with httpd-tools-2.2.34-1.16.amzn1.x86_64
mod24_ssl conflicts with 1:mod_ssl-2.2.34-1.16.amzn1.x86_64
httpd24 conflicts with httpd-2.2.34-1.16.amzn1.x86_64
To resolve this error, I replaced
packages:
yum:
mod_ssl : []
with
packages:
yum:
mod24_ssl.x86_64 : []
But that caused this error:
Httpd configuration detected in the '.ebextensions/httpd' directory. AWS Elastic Beanstalk will no longer manage the httpd configuration for this environment.
Executing: /usr/sbin/apachectl -t -f /var/elasticbeanstalk/staging/httpd/conf/httpd.conf
httpd: Syntax error on line 21 of /var/elasticbeanstalk/staging/httpd/conf/httpd.conf: Include/IncludeOptional: No matches for the wildcard '*.conf' in '/etc/httpd/conf.d/elasticbeanstalk', failing
Failed to execute '/usr/sbin/apachectl -t -f /var/elasticbeanstalk/staging/httpd/conf/httpd.conf'
Failed to execute '/usr/sbin/apachectl -t -f /var/elasticbeanstalk/staging/httpd/conf/httpd.conf' (Executor::NonZeroExitStatus)
AWS is asking to replace the current production server (Amazon Linux/2.3.1) without delay as it is "Retired". I have posted this issue on AWS Forum as well. Please help.
As indicated in the AWS documentation:
Starting with Tomcat platform version 3.0.0 configurations, which were released with the Java with Tomcat platform update on May 24, 2018, Apache 2.4 is the default proxy of the Tomcat platform.
After digging into the problem, as can be seeing for the comments and the companion chat, the actual solution for the problem was either create or clone the existing environment, with the idea of being able to use a fresh beanstalk environment for Amazon Linux 3.4.2, without any customization.
Then, in order to avoid the mentioned problem with SSL, the .ebextensions directory should only include a convenient ssl.conf and the environment.config script provided in the sample zip file indicated in the question, without the packages section because mod_ssl is already installed in the beanstalk image.
In this specific case, there were some additional problems related with the creation of the files required for logging. After adjusting the path to one in which the application has the ability to write, the default for Tomcat in Beanstalk, /var/logs/tomcat8, everything seems to work properly.
Save yourself pain. Do not configure SSL in your Tomcat Server, do it on an AWS Elastic Load Balancer ELB.

How to deploy KinesisAutoscaling.war on Java Application Server or Tomcat?

I want to manage kinesis shards automatically so I want to deploy KinesisAutoscaling.war on Tomcat. I found steps(https://github.com/awslabs/amazon-kinesis-scaling-utils) to deploy at Elastic Beanstalk.
Similar way I want step by step solution to deploy on Tomcat.
I was able to slow this problem using below steps.
Downlaod the code from here.
Open the project as Maven project in eclipse
Change the stream configuration in the configuration.json and provide the path of configuration in AutoscalingController.java like below
String configPath = "C:\
amazon-kinesis-scaling-utils-master\conf\configuration.json";
Build the project and place .jar file to the webapps folder of tomcat and start tomcat.

Installing Laravel on EC2 Instance

I'm brand new to AWS and this has got me stumped. I'm trying to install Laravel 4 on an instance I have on EC2 running the AMI Linux package. I don't have a domain for this, just using the free tier and trying it out.
Laravel needs to have the laravel/public folder as the document root but I can't work out how to do this. I've read loads of things about the conf.d folder vhosts file httpd.conf file and I don't really understand how it all fits together.
Can someone help me and tell me how I can set my documnent root so that when i visit my Elastic IP address it loads up correctly?
Thanks
If you want to access your laravel app by server ip you need to edit your httpd.conf file (usually in /etc/apache2 or /etc/httpd) and set the DocumentRoot option to the right directory.
DocumentRoot /var/www/laravel/public
and then restart apache