Launching C applications on an AMI's startup in AWS Elastic Beanstalk - amazon-web-services

Does anyone know if it's possible to make my own AMI's for use in the AWS Elastic Beanstalk? The AMI would simply have a C program that executes when the instance starts.

Yes, it is possible. Simply spin an EC2 instance up based on their stock beanstalk AMIs, which I believe Amazon makes available in the community AMI list, make your changes, cut an AMI off that fixed instance, and use that newest AMI id in your beanstalk application's configuration.
There is nothing abnormal or unusual about this.
Alternatively, you can use UserData and CloudInit to download and launch the application on instantiation. This would avoid having to change the stock AMI.

Related

Building an AWS Elastic Beanstalk platform from an AMI

I have configured an EC2 server with a specific set of packages and created a custom AMI from the instance which is setup just how I like it. I would like to use Elastic Beanstalk to generate a new instance with the same setup. Is that possible? When I am asked to select a platform in EBS my custom AMIs are not available to me. I cannot "apply" an AMI to an existing EC2 created by EBS.
I would like to know how Elastic Beanstalk makes use of custom AMIs. I cannot find a clear answer in the docs.
By default Elastic Beanstalk only provide Amazon Linux in case Linux OS. You can use your custom AMI with ElasticBeanstalk. In the AMI selection stage paste the AMI-ID of your custom AMI and you are good to go.

How can I bundle a aws ec2 windows machine with installed applications

I have a ec2 windows machine with adobe after effects running. I am trying to create a template from this ec2 instance which should allow me to launch new ec2 windows instances with adobe after effects already being preinstalled. However, it looks like that is not possible. The option to "bundle instance" is greyed out. Or have I misconfigured the ec2 template?
"Bundle" commands are outdated.
You should simply use Create Image to create an Amazon Machine Image (AMI) of the existing instance. Then, you can Launch an instance from the AMI and it will contain an exact copy of the AMI.
See: Creating a Custom Windows AMI - Amazon Elastic Compute Cloud
Recommendation: Run sysprep before creating the image. This will avoid conflicting machine IDs.
See: Create a Standard Amazon Machine Image Using Sysprep - Amazon Elastic Compute Cloud

Stop AWS Elastic Beanstalk from creating new instance

Is it possible to prevent Amazon Elastic Beanstalk from dropping an instance and creating a new one on its own, like for it to ask for approval first. I run a redis instance locally because elasticache is quite expensive and I dont want to have to keep installing and starting redis every time elastic beanstalk drops the instance and starts a new one. Is it possible to make sure it keeps a specific instance of EC2?
Elastic Beanstalk is meant for scaling web applications, so I'm not sure it's the right tool here.
If you are just looking to run a single instance with a manual install of redis at low cost, then launching an EC2 instance directly (rather than using Elastic Beanstalk) may be more appropriate?
You would of course then need to bear in mind that the EC2 would not automatically recover in the event of a problem, but it sounds like you don't have that currently anyway.

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.

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.