0

I tried the option of adding.platform or .ebextensions folder to the zip file to modify the ngnix setting to allow more than 1MB file but it did not work. I deployed my spring boot as a jar in Elastic Beanstalk. Can you please help me? Appreciate it. Thank you.

Update on the structure. I have used the following directory structures:

1) root of the zip folder

  • .platform
    • ngnix - conf.d - ngnix.conf
  • application.jar the contents of proxy.conf are: client_max_body_size 100M;

2)root of the zip folder

  • .ebextensions
    • ngnix - myconf.conf
  • application.jar

The content of the conf file myconf.conf:

files: "/etc/nginx/conf.d/proxy.conf": mode: "000755" owner: root group: root content: | client_max_body_size 100M;

I have referred to the following links:

  1. https://medium.com/innovation-res/how-to-configure-aws-ebs-to-handle-large-files-10411b9cecf0
  2. https://dev.to/rasoolk16/elastic-beanstalk-update-media-upload-size-53go
  3. https://harishkm.in/2020/08/06/uploading-large-files-to-aws-elastic-beanstalk-fails-with-http-413-request-entity-too-large/

Thank you, Jeelani

Update:

I've tried keeping the config file directly under .ebextensions and used the following formats to try it out.

  1. files: "/etc/nginx/conf.d/proxy.conf": mode: "000755" owner: root group: root content: | client_max_body_size 100M;

Noticed the following error:

The configuration file __MACOSX/.ebextensions/._01_nginx.config in application version showkase-source-20 contains invalid YAML or JSON. YAML exception: Invalid Yaml: org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 1, JSON exception: Invalid JSON: Unexpected character (�) at position 0.. Update the configuration file. 2) client_max_body_size 100M;

Let me go through the links you have provided and see what am I doing wrong. Thank you. Will keep you posted. But with either of these formats, I don't see the file appearing in /var/app/current. I see only the applicaiton.jar and Procfile.

Contents of config file:

files:
 "/etc/nginx/conf.d/01_proxy.conf":
  mode: "000644"
  owner: root
  group: root
  content: |
    client_max_body_size 20M;
jeelani
  • 1
  • 2

1 Answers1

0

You have used two different methods (via .platform/nginx hook and via .ebextensions). They are both valid, but only one should be needed.

While your platform hook seems fine, the .ebextensions is not according to the AWS documentation. It needs to have the file extension .config (not .conf) and the file needs to lie directly in the .ebextensions/ directory (not .ebextensions/nginx).

Some hints on debugging if this doens't fix your problem:

  • Check the following CloudWatch logs:
    • /aws/elasticbeanstalk/<yourAppName>/var/log/eb-engine.log
    • /aws/elasticbeanstalk/<yourAppName>/var/log/eb-hooks.log
    • /aws/elasticbeanstalk/<yourAppName>/var/log/nginx/error.log
  • Log into the EC2 instance via the Session Manager (located at the Systems Manager) to check the following:
    • Do you see all files of your zip in /var/app/current/?
    • What is the content of /etc/nginx/conf.d?

If this does not help, you can try the method in this SlackOverflow question. There, you will run a platform hook script that writes the config file manually.

Edit after you have corrected the above errors:

The contents of your config file seems to be correct. But the error message suggests that you have an invalid file encoding or a special character not matching the encoding (e.g., by copy and pasting from a website). You can use file 01_nginx.config to see the encoding. Best you delete the current config file and write it again by hand (without any copy & pasting) to ensure that no special characters sneak in.

Dennis Grunert
  • 387
  • 1
  • 10