CI/CD deployment of Prisma ORM to Elastic Beanstalk through CodePipeline - amazon-web-services

I'm trying to deploy a simple ExpressJS app with Prisma ORM.
Here is the full project: https://github.com/oxyn/aws-codebuild/settings
I'm trying to build through Amazon CodePipeline. For build, I have selected Ubuntu (aws/codebuild/standard:5.0). For Elastic Amazon is using Amazon Unix as I know.
I specified binaryTargets:
generator client {
provider = "prisma-client-js"
binaryTargets = ["rhel-openssl-1.0.x"]
}
but still, I can't get data.
"error": {
"clientVersion": "3.0.2"
},
This is an error that I'm getting inside of try-catch and this is log from Elastic:
----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Sep 12 04:59:50 ip-172-31-12-243 web: /var/app/current/node_modules/.prisma/client
Sep 12 04:59:50 ip-172-31-12-243 web: To solve this problem, add the platform "rhel-openssl-1.0.x" to the "binaryTargets" attribute in the "generator" block in the "schema.prisma" file:
Sep 12 04:59:50 ip-172-31-12-243 web: generator client {
Sep 12 04:59:50 ip-172-31-12-243 web: provider = "prisma-client-js"
Sep 12 04:59:50 ip-172-31-12-243 web: binaryTargets = ["native"]
Sep 12 04:59:50 ip-172-31-12-243 web: }
Sep 12 04:59:50 ip-172-31-12-243 web: Then run "prisma generate" for your changes to take effect.
Sep 12 04:59:50 ip-172-31-12-243 web: Read more about deploying Prisma Client: https://pris.ly/d/client-generator
Sep 12 04:59:50 ip-172-31-12-243 web: at LibraryEngine.getLibQueryEnginePath (/var/app/current/node_modules/#prisma/client/runtime/index.js:25285:15)
Sep 12 04:59:50 ip-172-31-12-243 web: at async LibraryEngine.loadEngine (/var/app/current/node_modules/#prisma/client/runtime/index.js:24947:35)
Sep 12 04:59:50 ip-172-31-12-243 web: at async LibraryEngine.instantiateLibrary (/var/app/current/node_modules/#prisma/client/runtime/index.js:24913:7)
I'm generating Prisma in post_build section:
post_build:
commands:
- echo Build completed on `date`
- npm run generate
What I'm doing wrong?

I had the same problem.
I add the command "npx prisma generate" after npm install

Related

Error In Deploying Fastapi api to aws elastic beanstalk

I am trying to deploy my fastapi api to aws elastic beanstalk, I zipped my code file app.py with the requirements.txt and .ebextensions folder that contains config file with the following: option_settings:
aws:elasticbeanstalk:application:environment:
PYTHONPATH: "/var/app/current:$PYTHONPATH"
aws:elasticbeanstalk:container:python:
WSGIPath: "app:app"
but I am getting the following error:
Feb 1 16:48:27 ip-172-31-45-195 web: [2023-02-01 16:48:27 +0000] [14516] [ERROR] Error handling request /
Feb 1 16:48:27 ip-172-31-45-195 web: Traceback (most recent call last):
Feb 1 16:48:27 ip-172-31-45-195 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 271, in handle
Feb 1 16:48:27 ip-172-31-45-195 web: keepalive = self.handle_request(req, conn)
Feb 1 16:48:27 ip-172-31-45-195 web: File "/var/app/venv/staging-LQM1lest/lib/python3.8/site-packages/gunicorn/workers/gthread.py", line 323, in handle_request
Feb 1 16:48:27 ip-172-31-45-195 web: respiter = self.wsgi(environ, resp.start_response)
Feb 1 16:48:27 ip-172-31-45-195 web: TypeError: call() missing 1 required positional argument: 'send'
any help
I tried to play with the config file but nothing worked

AWS Enviroment fails to connect with the Database

I've created a simple Spring Boot application in IntelliJ and tested the connection with the AWS database, which gives me no error. After creating a mvn clean install, I test the jar in the command-prompt, which also gives me no error. Great, I can upload my JAR file to my AWS Environment. I go to Environment > Configuration > Edit Database, and select my database in the snapshot drop down. But my Environment wound connect to the database. I don't get why it would work. I've been trying to run my app on AWS for days now and I feel I'm close, but don't know how to solve this problem. Plz check out my log:
----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Apr 20 06:15:19 ip-172-31-35-71 web: 2022-04-20 06:15:19.048:INFO::main: Logging initialized #367ms
Apr 20 06:15:19 ip-172-31-35-71 web: 2022-04-20 06:15:19.122:INFO:oejs.Server:main: jetty-9.2.z-SNAPSHOT
Apr 20 06:15:19 ip-172-31-35-71 web: 2022-04-20 06:15:19.201:INFO:oejs.ServerConnector:main: Started ServerConnector#2fcb66eb{HTTP/1.1}{0.0.0.0:5000}
Apr 20 08:34:45 ip-172-31-35-71 web: :: Spring Boot :: (v2.6.6)
Apr 20 08:34:45 ip-172-31-35-71 web: 2022-04-20 08:34:45.466 INFO 11107 --- [ main] c.e.S.SpringBootCrudExampleApplication : Starting SpringBootCrudExampleApplication v0.0.1-SNAPSHOT using Java 11.0.14.1 on ip-172-31-35-71.ec2.internal with PID 11107 (/var/app/current/application.jar started by webapp in /var/app/current)
Apr 20 08:34:45 ip-172-31-35-71 web: 2022-04-20 08:34:45.477 INFO 11107 --- [ main] c.e.S.SpringBootCrudExampleApplication : No active profile set, falling back to 1 default profile: "default"
Apr 20 08:34:47 ip-172-31-35-71 web: 2022-04-20 08:34:47.473 INFO 11107 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
Apr 20 08:34:47 ip-172-31-35-71 web: 2022-04-20 08:34:47.963 INFO 11107 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 472 ms. Found 1 JPA repository interfaces.
Apr 20 08:34:49 ip-172-31-35-71 web: 2022-04-20 08:34:49.554 INFO 11107 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 5000 (http)
Apr 20 08:34:49 ip-172-31-35-71 web: 2022-04-20 08:34:49.582 INFO 11107 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
Apr 20 08:34:49 ip-172-31-35-71 web: 2022-04-20 08:34:49.583 INFO 11107 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.60]
Apr 20 08:34:49 ip-172-31-35-71 web: 2022-04-20 08:34:49.769 INFO 11107 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
Apr 20 08:34:49 ip-172-31-35-71 web: 2022-04-20 08:34:49.769 INFO 11107 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4143 ms
Apr 20 08:34:50 ip-172-31-35-71 web: 2022-04-20 08:34:50.856 INFO 11107 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
Apr 20 08:34:50 ip-172-31-35-71 web: 2022-04-20 08:34:50.987 INFO 11107 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.7.Final
Apr 20 08:34:51 ip-172-31-35-71 web: 2022-04-20 08:34:51.362 INFO 11107 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
Apr 20 08:34:51 ip-172-31-35-71 web: 2022-04-20 08:34:51.585 INFO 11107 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
Apr 20 08:34:51 ip-172-31-35-71 web: 2022-04-20 08:34:51.957 INFO 11107 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
Apr 20 08:34:51 ip-172-31-35-71 web: 2022-04-20 08:34:51.979 INFO 11107 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
Apr 20 08:34:53 ip-172-31-35-71 web: 2022-04-20 08:34:53.137 INFO 11107 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
Apr 20 08:34:53 ip-172-31-35-71 web: 2022-04-20 08:34:53.148 INFO 11107 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
Apr 20 08:34:54 ip-172-31-35-71 web: 2022-04-20 08:34:54.000 WARN 11107 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
Apr 20 08:34:54 ip-172-31-35-71 web: 2022-04-20 08:34:54.946 INFO 11107 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 5000 (http) with context path ''
Apr 20 08:34:54 ip-172-31-35-71 web: 2022-04-20 08:34:54.965 INFO 11107 --- [ main] c.e.S.SpringBootCrudExampleApplication : Started SpringBootCrudExampleApplication in 11.253 seconds (JVM running for 12.875)
Apr 20 08:36:29 ip-172-31-35-71 web: 2022-04-20 08:36:29.654 INFO 11107 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
Apr 20 08:36:29 ip-172-31-35-71 web: 2022-04-20 08:36:29.658 INFO 11107 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
Apr 20 08:36:29 ip-172-31-35-71 web: 2022-04-20 08:36:29.690 INFO 11107 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
Events
INFO Environment health has transitioned from Warning to Ok.
WARN Environment health has transitioned from Warning to Ok.
INFO The environment was reverted to the previous configuration setting.
INFO Environment health has transitioned from Info to Warning. Configuration update failed 18 seconds ago and took 67 seconds.
The environment was reverted to the previous configuration setting.
Environment health has transitioned from Ok to Info. Configuration update in progress (running for 15 seconds).
ERROR Failed to deploy configuration.
ERROR Creating RDS database failed Reason: DB Instance class db.t2.micro does not support encryption at rest
ERROR Service:AmazonCloudFormation, Message:Stack named 'awseb-e-3a2mk3bca7-stack' aborted operation. Current state: 'UPDATE_ROLLBACK_IN_PROGRESS' Reason: The following resource(s) failed to create: [AWSEBRDSDatabase].
INFO Updating environment Invoice-env's configuration settings.
INFO Environment update is starting.

Grails 4: Mail plugin fails to read 'password' property when running on Elastic Beanstalk

My Grails 4 application runs fine locally but fails to send emails when I run it in Elastic Beanstalk. I'm using the runnable WAR file on Java 11 platform using the embedded (not external) Tomcat server.
I'm setting the grails.mail.password property externally via a GRAILS_MAIL_PASSWORD environment variable.
I'm checking the config value in BootStrap.groovy and in the EmailsService, and the value is properly set.
BootStrap
class BootStrap {
GrailsApplication grailsApplication
def init = { servletContext ->
String config = "\n"
grailsApplication.config.each {
config += " --> $it.key : ${grailsApplication.config.getProperty(it.key)}\n"
}
log.info(config)
EmailService
class EmailService {
#Value('${cloudcard.email.doNotSend}')
boolean doNotSend
#Value('${grails.mail.username}')
String grailsMailUsername
#Value('${grails.mail.password}')
String grailsMailPassword
#PostConstruct
void init() {
log.info("grailsMailUsername: ${grailsMailUsername.take(2)}****${grailsMailUsername.reverse().take(2).reverse()}")
log.info("grailsMailPassword: ${grailsMailPassword.take(4)}****${grailsMailPassword.reverse().take(4).reverse()}")
}
EmailService Log Output
Nov 16 02:48:32 ip-172-31-31-36 web: 2021-11-16 02:48:32.946 INFO --- [io-5000-exec-10] us.cloudcard.api.EmailService : grailsMailUsername: AK****G2
Nov 16 02:48:32 ip-172-31-31-36 web: 2021-11-16 02:48:32.946 INFO --- [io-5000-exec-10] us.cloudcard.api.EmailService : grailsMailPassword: BI****5Z
Nov 16 02:48:33 ip-172-31-31-36 web: 2021-11-16 02:48:33.311 ERROR --- [pool-4-thread-1] grails.plugins.mail.MailMessageBuilder : Failed to send email
Nov 16 02:48:33 ip-172-31-31-36 web: org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException:
failed to connect, no password specified?
Nov 16 02:48:33 ip-172-31-31-36 web: at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:440)
Nov 16 02:48:33 ip-172-31-31-36 web: at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:361)
Nov 16 02:48:33 ip-172-31-31-36 web: at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:356)
Nov 16 02:48:33 ip-172-31-31-36 web: at org.springframework.mail.javamail.JavaMailSender$send$0.call(Unknown Source)
Nov 16 02:48:33 ip-172-31-31-36 web: at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
Nov 16 02:48:33 ip-172-31-31-36 web: at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
Nov 16 02:48:33 ip-172-31-31-36 web: at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
Nov 16 02:48:33 ip-172-31-31-36 web: at grails.plugins.mail.MailMessageBuilder$_sendMessage_closure1.doCall(MailMessageBuilder.groovy:124)
Nov 16 02:48:33 ip-172-31-31-36 web: at grails.plugins.mail.MailMessageBuilder$_sendMessage_closure1.doCall(MailMessageBuilder.groovy)
Nov 16 02:48:33 ip-172-31-31-36 web: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Nov 16 02:48:33 ip-172-31-31-36 web: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Nov 16 02:48:33 ip-172-31-31-36 web: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Nov 16 02:48:33 ip-172-31-31-36 web: at java.base/java.lang.reflect.Method.invoke(Method.java:566)
Nov 16 02:48:33 ip-172-31-31-36 web: at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
Nov 16 02:48:33 ip-172-31-31-36 web: at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
Nov 16 02:48:33 ip-172-31-31-36 web: at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263)
Nov 16 02:48:33 ip-172-31-31-36 web: at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
Nov 16 02:48:33 ip-172-31-31-36 web: at groovy.lang.Closure.call(Closure.java:405)
Nov 16 02:48:33 ip-172-31-31-36 web: at groovy.lang.Closure.call(Closure.java:399)
Nov 16 02:48:33 ip-172-31-31-36 web: at groovy.lang.Closure.run(Closure.java:486)
Nov 16 02:48:33 ip-172-31-31-36 web: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
Nov 16 02:48:33 ip-172-31-31-36 web: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
Nov 16 02:48:33 ip-172-31-31-36 web: at java.base/java.lang.Thread.run(Thread.java:829)
Nov 16 02:48:33 ip-172-31-31-36 web: Caused by: javax.mail.AuthenticationFailedException: failed to connect, no password specified?
Nov 16 02:48:33 ip-172-31-31-36 web: at javax.mail.Service.connect(Service.java:400)
Nov 16 02:48:33 ip-172-31-31-36 web: at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:518)
Nov 16 02:48:33 ip-172-31-31-36 web: at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:437)
Nov 16 02:48:33 ip-172-31-31-36 web: ... 22 common frames omitted
But...
...if I hardcode the username and password into application.groovy, everything works, and I receive the email in my inbox. I'm not sure if it matters, but this is one of the only things I have configured in application.groovy. Almost everything else is in application.yml.
Do you have any idea why the Grails Mail Plugin might be ignoring my external config?
As a workaround, I've redeployed the same application using the external Tomcat container platform (Amazon Linux 2; Tomcat 8.5; Corretto Java 11) and the application is now respecting the environment variables.

AWS: Simple cfn-init fails on Amazon Linux 2 for no apparent reason

I am provisioning a cloudformation stack. I am just trying to run the simplest possible cfn-initever on an instance started using a custom ami that was based on Amazon Linux 2:
EC2ESMasterNode1:
Type: AWS::EC2::Instance
Metadata:
Comment: ES Cluster Master 1 instance
AWS::CloudFormation::Init:
config:
commands:
01_template_elastic:
command:
!Sub |
echo "'Hello World'"
Properties:
ImageId: ami-09693313102a30b2c
InstanceType: !Ref MasterInstanceType
SubnetId: !Ref Subn1ID
SecurityGroupIds: [!Ref SGES]
KeyName: mykey
UserData:
"Fn::Base64":
!Sub |
#!/bin/bash -xe
# Start cfn-init
/opt/aws/bin/cfn-init -s ${AWS::StackName} --resource EC2ESMasterNode1 --region ${AWS::Region}
# Send the respective signal to Cloudformation
/opt/aws/bin/cfn-signal -e 0 --stack ${AWS::StackName} --resource EC2ESMasterNode1 --region ${AWS::Region}
Tags:
- Key: "Name"
Value: !Ref Master1NodeName
The /var/log/cloud-init-output.log has the following print
No packages needed for security; 15 packages available
Resolving Dependencies
Cloud-init v. 18.2-72.amzn2.0.6 running 'modules:final' at Wed, 02 Jan 2019 12:41:26 +0000. Up 14.42 seconds.
+ /opt/aws/bin/cfn-init -s test-elastic --resource EC2ESMasterNode1 --region eu-west-1
+ /opt/aws/bin/cfn-signal -e 0 --stack test-elastic --resource EC2ESMasterNode1 --region eu-west-1
ValidationError: Stack arn:aws:cloudformation:eu-west-1:248059334340:stack/test-elastic/9fc79150-0e8b-11e9-b135-503ac9e74cfd is in CREATE_COMPLETE state and cannot be signaled
Jan 02 12:41:27 cloud-init[2575]: util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]
Jan 02 12:41:27 cloud-init[2575]: cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
Jan 02 12:41:27 cloud-init[2575]: util.py[WARNING]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_scripts_user.pyc'>) failed
Cloud-init v. 18.2-72.amzn2.0.6 finished at Wed, 02 Jan 2019 12:41:27 +0000. Datasource DataSourceEc2. Up 15.30 seconds
The /var/log/cloud-init.log has the following errors:
Jan 02 12:41:26 cloud-init[2575]: handlers.py[DEBUG]: start: modules-final/config-scripts-user: running config-scripts-user with frequency once-per-instance
Jan 02 12:41:26 cloud-init[2575]: util.py[DEBUG]: Writing to /var/lib/cloud/instances/i-0c10a5ff1be475b99/sem/config_scripts_user - wb: [644] 20 bytes
Jan 02 12:41:26 cloud-init[2575]: helpers.py[DEBUG]: Running config-scripts-user using lock (<FileLock using file '/var/lib/cloud/instances/i-0c10a5ff1be475b99/sem/config_scripts_user'>)
Jan 02 12:41:26 cloud-init[2575]: util.py[DEBUG]: Running command ['/var/lib/cloud/instance/scripts/part-001'] with allowed return codes [0] (shell=True, capture=False)
Jan 02 12:41:27 cloud-init[2575]: util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]
Jan 02 12:41:27 cloud-init[2575]: util.py[DEBUG]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 860, in runparts
subp(prefix + [exe_path], capture=False, shell=True)
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 2053, in subp
cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: ['/var/lib/cloud/instance/scripts/part-001']
Exit code: 1
Reason: -
Stdout: -
Stderr: -
Jan 02 12:41:27 cloud-init[2575]: cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
Jan 02 12:41:27 cloud-init[2575]: handlers.py[DEBUG]: finish: modules-final/config-scripts-user: FAIL: running config-scripts-user with frequency once-per-instance
Jan 02 12:41:27 cloud-init[2575]: util.py[WARNING]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_scripts_user.pyc'>) failed
Jan 02 12:41:27 cloud-init[2575]: util.py[DEBUG]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_scripts_user.pyc'>) failed
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 798, in _run_modules
freq=freq)
File "/usr/lib/python2.7/site-packages/cloudinit/cloud.py", line 54, in run
return self._runners.run(name, functor, args, freq, clear_on_fail)
File "/usr/lib/python2.7/site-packages/cloudinit/helpers.py", line 187, in run
results = functor(*args)
File "/usr/lib/python2.7/site-packages/cloudinit/config/cc_scripts_user.py", line 45, in handle
util.runparts(runparts_path)
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 867, in runparts
% (len(failed), len(attempted)))
RuntimeError: Runparts: 1 failures in 1 attempted commands
Jan 02 12:41:27 cloud-init[2575]: stages.py[DEBUG]: Running module ssh-authkey-fingerprints (<module 'cloudinit.config.cc_ssh_authkey_fingerprints' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_ssh_authkey_fingerprints.pyc'>) with frequency once-per-instance
_
cat /var/log/cfn-init-cmd.log
2019-01-02 12:50:54,777 P2582 [INFO] ************************************************************
2019-01-02 12:50:54,777 P2582 [INFO] ConfigSet default
2019-01-02 12:50:54,778 P2582 [INFO] ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2019-01-02 12:50:54,778 P2582 [INFO] Config config
2019-01-02 12:50:54,778 P2582 [INFO] ============================================================
2019-01-02 12:50:54,778 P2582 [INFO] Command 01_template_elastic
2019-01-02 12:50:54,782 P2582 [INFO] -----------------------Command Output-----------------------
2019-01-02 12:50:54,782 P2582 [INFO] 'Hello World'
2019-01-02 12:50:54,783 P2582 [INFO] ------------------------------------------------------------
2019-01-02 12:50:54,783 P2582 [INFO] Completed successfully.
Does anyone have a clue what the error is about?
Furthermore, why the stack is created with success? (as also the specific resource?)
The error message in /var/log/cloud-init.log means that your UserData script exited with error status 1 rather than the expected 0.
Meanwhile, your /var/log/cloud-init-output.log contains this line:
ValidationError: Stack arn:aws:cloudformation:eu-west-1:248059334340:stack/test-elastic/9fc79150-0e8b-11e9-b135-503ac9e74cfd
is in CREATE_COMPLETE state and cannot be signaled
To your other question:
Furthermore, why the stack is created with success? (as also the specific resource?)
It is the normal behaviour of the stack to go into CREATE_COMPLETE state once the resources are created. The running of the UserData script doesn't by default delay this state.
Because you are using the cfn-signal, I assume that you have a requirement for the CREATE_COMPLETE state to be deferred until such time as you send the signal in UserData.
There is a good blog post on how to set this all up here.
But tl;dr -
You probably just need to add a CreationPolicy to your EC2 instance resource like this:
Resources:
EC2ESMasterNode1:
...
CreationPolicy:
ResourceSignal:
Count: 1
Timeout: PT10M
That says wait for 1 signal and time out after 10 minutes. Set those according to your requirements obviously.

Failed to start Kibana on AWS machine

I'm following blog post about using ELK stack. Machine for instalation is an amazon small Ubuntu instance.
I got to the point when I need to install Kibana service so I run:
sudo apt-get install kibana
Then I changed in /etc/kibana/kibana.yml
server.port: 5601
elasticsearch.url: "0.0.0.0:9200"
since I can get response from elasticsearch sudo curl 0.0.0.0:9200
then I run
sudo service kibana start
And after running sudo service kibana status I receiving:
x#ip-xx-xx-xx-xx:/$ sudo service kibana status
● kibana.service - Kibana
Loaded: loaded (/etc/systemd/system/kibana.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2016-12-02 13:52:55 UTC; 13ms ago
Main PID: 5921 (node)
Tasks: 6
Memory: 1.1M
CPU: 3ms
CGroup: /system.slice/kibana.service
└─5921 /usr/share/kibana/bin/../node/bin/node --no-warnings /usr/share/kibana/bin/../src/cli -c /etc/kibana/kibana.yml
Dec 02 13:52:55 ip-xx-xx-xx-xx systemd[1]: Started Kibana.
x#ip-xx-xx-xx-xx:/$ sudo service kibana status
● kibana.service - Kibana
Loaded: loaded (/etc/systemd/system/kibana.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Dec 02 13:52:56 ip-xx-xx-xx-xx kibana[5921]: buildSha: '8f2ace746d1b84702bb618308efa65dc0c3f8a34' },
Dec 02 13:52:56 ip-xx-xx-xx-xx kibana[5921]: dev: { basePathProxyTarget: 5603 },
Dec 02 13:52:56 ip-xx-xx-xx-xx kibana[5921]: pid: { exclusive: false },
Dec 02 13:52:56 ip-xx-xx-xx-xx systemd[1]: kibana.service: Main process exited, code=exited, status=1/FAILURE
Dec 02 13:52:56 ip-xx-xx-xx-xx systemd[1]: kibana.service: Unit entered failed state.
Dec 02 13:52:56 ip-xx-xx-xx-xx systemd[1]: kibana.service: Failed with result 'exit-code'.
Dec 02 13:52:57 ip-xx-xx-xx-xx systemd[1]: kibana.service: Service hold-off time over, scheduling restart.
Dec 02 13:52:57 ip-xx-xx-xx-xx systemd[1]: Stopped Kibana.
Dec 02 13:52:57 ip-xx-xx-xx-xx systemd[1]: kibana.service: Start request repeated too quickly.
Dec 02 13:52:57 ip-xx-xx-xx-xx systemd[1]: Failed to start Kibana.
Unfortunatelly log is not created under directory /var/log/kibanaeven after setting rights by chown kibana:kibana /var/log/kibana:
ll /var/log/kibana/
total 8
drwxr-xr-x 2 kibana kibana 4096 Dec 2 10:20 ./
drwxrwxr-x 9 root syslog 4096 Dec 2 09:50 ../
First of all I wish to see Kibana log (whole problem resolution will be even better :) )