Installing dependencies through elastic beanstalk config files versus eb ssh - amazon-web-services

I am having trouble installing a specific dependency in my elastic beanstalk environment via a .config file in the .ebextensions directory.
Are there any issues caused by instead installing it directly onto the instance via "eb ssh"? If my application was auto-scaled or if I wanted to change the instance type, will the dependency be missing from these new instance(s)?

There will be issues when the application get's auto-scaled. An EC2 instance provisioned by Elastic Beanstalk has the following MOTD:
This EC2 instance is managed by AWS Elastic Beanstalk. Changes made via SSH
WILL BE LOST if the instance is replaced by auto-scaling. For more information
on customizing your Elastic Beanstalk environment, see our documentation here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html
Use the custom container approach suggested if you're aiming to create a highly customized beanstalk environment.

Related

Multiple elastic beanstalk environment in one ec2 instance

I am using aws elastic beanstalk to host my django application. We need to setup dev, stage and Prod environment of the application. But whenever I am using eb create command, it is also launching a new ec2 instance for the new environment.
Is it possible to set up multiple elastic beanstalk Environment in single ec2 instance. Also if I want to host a WordPress website in one of these instance can I do so by ssh logging into your the system and putting website in public web directory ?
If you can host your application within a docker container then you can use Multicontainer Docker Environment and run multiple docker containers on the same environment.
Read about multi-container docker environments in ElasticBeanstalk here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecs.html
No.
Elastic Beanstalk create EC2 instances per environment. U can have single instance or elastic instance setups.
Yes you can SSH onto an EB Instance.
No you can't expect your changes to remain. The message when you SSH onto the EB Instance says as much.
Its a managed service for you.
The concept of having your EB Elastic destroys your capability for baking the EC2 instance it makes.
Use your GIT repository to put the Wordpress site on the EB and use a Database to pre-define it.. however you'll have state and media issues to overcome...

wurfl on elastic beanstalk

I have setup php environment on elastic beanstalk and uploading code through eb deploy command. EC2 instance is created by auto-scaling group and I can connect it using putty. I want to install wurfl on ec2, I want to know :
1) if I install wurfl on current running ec2 instance, will it get installed on other instance created by auto-scale group ?
2) if not, then how can I install wurfl on beanstalk
No, do not modify your Elastic Beanstalk instances manually. It will not replicate to another (existing/new) instances.
If you want to customize your instances, you can create .ebextensions scripts. Please take a look into http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html.

AWS EC2 and Elastic Beanstalk

I am new to AWS and the question may seem very basic. However I need to see if I can find a solution to this.
I have created and launched an EC2 instance first and then created an Elastic Beanstalk instance with a sample application deployed on it. By default, the Elastic Beanstalk attaches "Default Environment" to this instance and I find no way to change this to my EC2 instance. How can I attach my EC2 instance (that I created earlier) to this Elastic Beanstalk instance? I am using Amazon Free Tier to learn.
Thanks a lot for your time and patience.
You cannot add an existing instance into an Elastic Beanstalk configuration.
Under the hood Elastic beanstalk uses Containers and a ton of configuration hooks, files, etc.
An instance is not the same and cannot even be guaranteed to be of matching types (perhaps the instance is CentOS and the Container runs on an ubuntu host).
It's simply not possible.

Change RDS Configuration in Elastic Beanstalk App?

I want to change my RDS Instance that is connected to my Elastic Beanstalk Application, from a db.t1.micro to a db.m1.small. If I go to my Elastic Beanstalk Application and go to "Configuration", I can only see the current settings, but I'm unable to change them.
I then went into the Console -> RDS -> Instances, and updated my Instance from the RDS Menu, and set it as a db.m1.small. On RDS it now says that it's an db.m1.small, however on the Elastic Beanstalk Configuration Page, it still says that the application is running a db.t1.micro instance.
So a few questions:
Did I upgrade my instance in the "correct" way? Or is there another way I'm suppose to configure my RDS Instance that is set up with my Elastic Beanstalk App?
Any ideas why the different pages are saying different configurations?
If RDS console says that the RDS instance type is m1.small then it has been changed to m1.small. The two pages are showing different values because beanstalk provisioned a t1.micro instance instance for you and hence thinks you have a t1.micro db instance. If you rebuild your environment then the new environment should have the same configuration and hence a t1.micro instance.
Changing it via the RDS console does not change the configuration on Beanstalk, hence you see different values.
However if the RDS instance was created via Beanstalk then the correct way to update your db instance type would be using Elastic Beanstalk option settings.
You can make the change using AWS CLI if not using the console.
http://docs.aws.amazon.com/cli/latest/reference/
Just run the following command:
aws elasticbeanstalk --update-environment --environment-name <your-env-name> --option-settings Namespace=aws:rds:dbinstance,OptionName=DBInstanceClass,Value=db.m1.small
Try the above command.
More information on update-environment via aws cli:
http://docs.aws.amazon.com/cli/latest/reference/elasticbeanstalk/update-environment.html
Read more about option settings and ebextensions here.

Customizing an Elastic Beanstalk AMI

I need to use on Elastic Beanstalk a Java application written for Glassfish server.
Beacuse of Amazon doesn't let me choose an AMI with Glassfish, I choosed one with Tomcat and i modified my application to work properly on Tomcat.
Now, I've seen I also needed to use a Sun JDK, while by default Elastic Beanstalk AMI comes with openjdk. I googled a lot, finding some (not so many resources) interesting posts like this answer on StackOverflow
What I can't understand is this part of the answer:
Create your custom AMI from a running instance of Amazon's beanstalk
AMI that you manually launch from EC2, NOT one that was launched from
starting your application through beanstalk.
So, my question is: does anyone how to use a custom AMI with Glassfish on Elastic Beanstalk?
If it's not possible, can someone explain me how to create the custom AMI?
Thanks,
Andrea
That answer just means "Don't start a beanstalk application and cut an AMI directly from one of those instances. Instead, launch an instance based on the beanstalk AMIs (which are available in the public AMI listing)." I.e., use one of these; note there are 84 of them:
Cut your own private AMI when you're done configuring that instance, and specify it in your beanstalk environment.
I personally found the selected answer confusing for me to follow, maybe because I am still climbing up the AWS learning curve. Maybe this answer will help other newbies. Having just figured out how to successfully launch an Elastic Beanstalk instance with my own custom AMI, what I believe this quote is saying, is to do the following totally non-obvious steps which just worked for me:
Go to the EC2 services (not Elastic Beanstalk services) and launch an instance based on the Elastic Beanstalk AMI that you would like to use as a starting point for your custom AMI. You will throw this away in a minute.
Select the instance and choose "Create Image / EBS AMI". Once created, you can delete the temporary EC2 instance you created. It's only purpose was to create the custom AMI.
Now go to Elastic Beanstalk services and edit your configuration to reference your custom AMI.
#Danger It would speed up the scaling up process.
I'm using a docker app on EB but "docker pull" from Docker Hub is so slow so when all instances are unhealthy my site would be down in 15-30 minutes. Create a customize AMI and pull a base Docker image will save time.