Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YAML exception: Invalid Yaml

I am trying to implement encryption a Tomcat Server on AWS Elastic Beanstalk.

I have just followed this, and created a .ebextensions/https-instance.config file.

enter image description here

But when I deploy to the server, I get:

The configuration file .ebextensions/https-instance.config in application version thewhozoo-1.0.0.25 contains invalid YAML or JSON. YAML exception: Invalid Yaml: while scanning a simple key in "", line 4, column 1: -----BEGIN CERTIFICATE----- ^ could not found expected ':' in "", line 5, column 1: MIIDnDCCAoACCQCzIxYAYJicIjANBgkq ... ^ , JSON exception: Invalid JSON: Unexpected character (f) at position 0.. Update the configuration file.

What I am doing incorrectly?

UPDATE

I changed the file to:

enter image description here

But get the following:

The configuration file .ebextensions/https-instance.config in application version thewhozoo-1.0.0.31 contains invalid YAML or JSON. YAML exception: Invalid Yaml: while parsing a block mapping in "", line 7, column 5: mode: "000400" ^ expected , but found Scalar in "", line 32, column 6: -----END CERTIFICATE----- ^ , JSON exception: Invalid JSON: Unexpected character (p) at position 0.. Update the configuration file.

like image 366
Richard Avatar asked Jan 21 '26 12:01

Richard


1 Answers

You'll have to indent your certificate data more than the column of content:

files:
  /etc/pki/tls/certs/server.crt:
    content: |
      -----BEGIN CERTIFICATE----
      MI.......
      Wk.......

That is the way the literal scalar in block style works. As you can have empty lines in such a literal scalar, as well as (further) indented lines, the parser would otherwise not know that your scalar had ended or not (that is would not assume /etc/pki/tls/certs/server.key: to be part of the literal scalar).

like image 68
Anthon Avatar answered Jan 24 '26 01:01

Anthon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!