Install ghostscript on load balanced Aws Beanstalk - amazon-web-services

I am using ghostscript on my current server. Now I am moving to an Aws beanstalk server with Application load balancer.
How do I configure start-up script on elastic beanstalk so whenever a new instance is created by the load balancer, ghostscript is automatically installed.

You can control what's installed in ElasticBeanstalk instances with .ebextensions file.
Whenewher Elastic Beanstalk creates a new EC2 instance, it will run all commands from the file in order to provision instance.
Example of .ebextensions file for installing Ghostscript
packages:
yum:
ghostscript: []
This will install a version of ghostscript from yum repository.
If you need a never version of ghostscript - it is also possible to specify installation shell commands inside ebextensions file. For example, these commands will install Ghostscript 9.23

Related

How to connect to existing elastic beanstalk instance locally from cli?

I am very much new to aws. I have created an environment in elastic beanstalk and deployed my application there using zipped code. The application is up and running now. Now i want to stop and start my elastic beanstalk instance from cli in windows. I could not find any stop button in the aws elastic beanstalk console.
I have installed awsebcli using below command:
pip install awsebcli
Now, i want to connect to my existing environment in elastic beanstalk and stop or start the environment at my will.
How can i do that?
The way the EBCLI (awsebcli) works is that you associate an empty directory on your computer with an EB application.
go to an empty directory
eb init --region <region name>. When prompted for the application name, choose the application you created previously.
eb terminate <environment name>. This will terminate the environment.
To create a new environment, perform eb create.

How can automatic deploy yii2 app when Elastic Beanstalk instance is terminated and created a new instance

Currently I have setup my yii2 website on AWS Elastic beanstalk. I followed following steps :
Created Elastic Beanstalk app and environment : Platform PHP 7.0, RDS database
Created SSH connection from EC2 instance of elastic beanstalk using putty with .pem file
In Apache folder I have cloned my yii2 git repo using (sudo git clone repo_url) command
Installed composer using this link https://gist.github.com/asugai/6694502
Run command : (sudo composer install) in my repo folder
Edited common/config/main-local.php and made db connection
And run migration using (sudo php yii migrate)
Setup a domain for this elastic beanstalk app
Now I don't know how should I proceed further and I am facing following problems :
Elastic Balance loader is creating new instance and terminating current one when it fails or health goes in severe.
Due this, my all data in that instance is lost. To make it work I am doing all steps again and again manually.
How can I make my domain https (SSL certified)
How can make easy process to pull new changes from git
I already have a working site in nodeJS. which is using elastic beanstalk, elastic balance loader, RDS(postgres), S3 bucket, cloudfront for Route 53, SSL certificate (https), code pipeline, code commit. And AWSCLI at local to deploy nodeJS app.
my question is about I want to use same flow for yii2 advance app.
Can anyone please help me here?
Thanks in advance :)

Where are the node.js app files installed in an AWS elastic beanstalk instance?

In an AWS elasticbeanstalk instance, where are the node.js app files deployed to? I wanted to ssh to the machine and debug some issues and wanted to check that the files were deployed correctly. I checked /var/ but didn't see an app directory there.
It's in the /tmp/deployment/application folder during deployment and then it is moved to /var/app/current.
The node logs are in /var/log/nodejs/nodejs.log

Configuring an Application Load Balancer for Elastic beanstalk

I'm trying to configure an ALB for my elb deployment.
I've followed the aws tutorial
but when I'm running eb create test-env --elb-type application
I get: eb: error: unrecognized arguments: --elb-type application
I've updated my eb cli using aws tutorial
(running EB CLI 3.7.6 (Python 2.7.1))
Many Thanks
It looks like you are using an older version of the EB CLI. The support for Application Load Balancers was added in 3.7.8: https://pypi.python.org/pypi/awsebcli
You can upgrade your CLI version by running:
pip install --upgrade awsebcli

How do I install third-party binaries in Elastic Beanstalk?

What should I do in order to install third party programs such as imagemagick on Elastic Beanstalk so I can use them from my nodejs web app?
Elastic Beanstalk will read configuration files from the .ebextensions directory in your application source bundle. You can create configuration files there that customize many aspects of the EC2 instances that get created to run your application.
Here is an example config file that would install the latest ImageMagick version on your EC2 instances:
packages:
yum:
ImageMagick: []
See the full AWS documentation here for more ways to customize your environment: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html