Change Elastic Beanstalk environment from Launch Configuration to Launch Template - amazon-web-services

The Elastic Beanstalk docs say:
Web server environments have ... one of the following two resources.
AWSEBAutoScalingLaunchConfiguration (AWS::AutoScaling::LaunchConfiguration) – The launch configuration attached to your environment's Auto Scaling group.
AWSEBEC2LaunchTemplate (AWS::EC2::LaunchTemplate) – The Amazon EC2 launch template used by your environment's Auto Scaling group.
AWS is in the process of deprecating Launch Configurations, as Launch Templates are strictly more featured. In particular, AWS has sent a notice to customers saying:
After December 31, 2022 no new Amazon Elastic Compute Cloud (Amazon EC2) instance types will be added to launch configurations.
How do I convert an Elastic Beanstalk environment that is currently using a Launch Configuration to use a Launch Template instead?

I have contacted AWS support about this issue. As of December 31 2022 AWS will deprecate launch configurations. So we have to use launch templates instead of launch configurations. And this is their response.
Firstly, the current guidance is that no action will be needed on your
end regarding the launch configuration deprecation. Beanstalk will use
launch configurations when needed, and will automatically use launch
templates for new instances and newer features as needed. However, I
will be sure to update you if this guidance changes.
However, if you wish to change your Elastic Beanstalk environments to
make use of launch templates instead of a launch configuration, I
suggest to enable the 'Disable IMDSv1' option in your EB environments
configuration [2]. IMDS is instance metadata service and is used by
code to access instance metadata. Disabling IMDSv1 requires using
Amazon EC2 launch templates. When you configure this feature during
environment creation or updates, Elastic Beanstalk attempts to
configure your environment to use Amazon EC2 launch templates (if the
environment isn't using them already).If you have custom scripts which
communicates with the IMDSv1 endpoint, then you will need to ensure
those are migrated to the newer IMDSv2 [3].
Additionally, please note that this may introduce some downtime while
the configuration changes are being applied to the environment. I
recommend creating a new environment and performing a Blue/Green
deployment [4] to minimize this potential downtime. Please test this
is in your non production and proceed to production based on the
results in non-production.
Please refer the provided documentation and let me know if you need
any help.
References:
[1] Managing environments - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.html
[2] Configuring IMDS using the Elastic Beanstalk console - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environments-cfg-ec2-imds.html#environments-cfg-ec2-imds.console
[3] IMDSv2 - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html
[4] Blue/Green deployments with Elastic Beanstalk - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.CNAMESwap.html

I was in this exact position. I connected with AWS support and the answer I received is that launch configurations being used in Elastic beanstalk apps will be migrated automatically behind the scenes. So if your only launch configurations are generated as part of an elastic beanstalk then you have nothing to do, and the notice only applies to configurations created outside of Elastic Beanstalk.

Related

AWS Elastic Beanstalk: Steps to move existing RDS from db.t1.micro to db.t2.small

I'm new to AWS and having a web server environment on elastic beanstalk with EC2 (t1.micro) with RDS (db.t1.micro). Now the db.t1.micro instance is deprecated, no more new instance can be created and no support in near future.
I would be helpful if anybody refers me steps to do create the t2 clone of the machine and switch over (Or) how to handle the depreciation of the instance.
Change Instance Type: You can change the Instance type by following the AWS documentation here
Next, Creating RDS instance in the Elastic Beanstalk environment is not ideal for production environments, because the lifecycle of the database instance is tied to the lifecycle of your application's environment. Hence it is always recommended to create RDS instance outside of the Elastic Beanstalk environment and configure your Elastic Beanstalk application to connect it on launch, which will provide the benefits of performing blue/green deployments, and tear down your Beanstalk environment without affecting the database instance. Refer to the documentation here to know more information.
For now, if you would like to modify the RDS instance type, you can do so by going to the RDS section in Configuration tab.
I have created a new Elastic Beanstalk environment with the source of the "db.t1.micro" snapshot, within the VPC. This helped me to launch the clone. Once this is done I have to swap the cname with the t1 and t2 setup. The new instance is up and running with t2 configuration.

AWS, Beanstalk, Autoscaling EC2 configuration

I just started hosting a legacy classic ASP app on AWS Beanstalk. When I created the environment, I used RDP to remote into the Windows machine and configure IIS with classic ASP, server includes etc.
Funny thing (or not) is that sometimes the Autoscaler adds an instance (scales up) and then removes an instance (scales down). If it removes my originally configured server, I loose the changes I made via RDP and my website goes down.
Is there a way to specify how the scaled EC2 instance is configured?
Many thanks,
Thanks for the comments that set me onto this. I used the AWS console for all of this and solved my issue.
From the EC2 instance page, create an AMI of your configured EC2 instance
Under EC2 > Auto Scaling > Launch Configuration create a new launch configuration using your AMI. You will see a previously created configuration created by Beanstalk but you are creating your own.
Under EC2 > Auto Scaling > Auto Scaling Groups you will see a group already created by Beanstalk. Edit this Auto Scaling group and specify your new launch configuration.
Hope this helps,

Amazon Web Services - Using an existing EC2 instance as Beanstalk environment

I'm new to AWS, and I want to deploy a web application on an EC2 instance,
So far I've tried Elastic Beanstalk, but AWS always requires me to create a new Environment for the application instead of letting me choose an existing EC2 instance that I've created before.
Actually my main purpose is to set a policy group that allow HTTPS access, and idk how to set it to the "Environment" instance.
Any help is greatly welcome. :)
That is not currently viable, as you'd need to set up an AMI based on your instance and use a custom AMI for beanstalk, and that is not a trivial task. If you need to run a custom environment in Elastic Beanstalk, using Docker would be much easier.
But none of that is required to set a security group allowing HTTPS, you can configure security groups and HTTP/s listeners for ELBs on you Environment configuration.

AWS EC2: Why does ".NET Beanstalk HostManager v1.0.1.1" keep coming back

I keep killing the default instance and it keeps coming back. Why?
This answer is based on the assumption that you are facing a specific issue I've seen several users stumbling over, but your question is a bit short on detail, so I might misinterpret your problem in fact.
Background
The AWS Toolkit for Visual Studio allows you to deploy applications to AWS Elastic Beanstalk, which is a Platform as a Service (PaaS) offering allowing you to quickly deploy and manage applications in the AWS cloud:
You simply upload your application, and Elastic Beanstalk
automatically handles the deployment details of capacity provisioning,
load balancing, auto-scaling, and application health monitoring.
You deploy an application to Elastic Beanstalk into an Environment comprised of an Elastic Load Balancer and resp. Auto Scaling policies, which together ensure your application will keep running even if the EC2 instance is having trouble servicing the requests for whatever reason (see Architectural Overview for an explanation and illustration how these components work together).
That is, your Amazon EC2 instances are managed by default, so you don't need to administrate the infrastructure yourself, but the specific characteristic of this AWS PaaS variation is that you still can do that:
At the same time, with Elastic Beanstalk, you retain full control over
the AWS resources powering your application and can access the
underlying resources at any time.
Now that's exactly what you unintentionally did by terminating the EC2 instance via a mechanism outside of the Elastic Beanstalk service, which the load balancer detects and, driven by those auto scaling policies, triggers the creation of a replacement instance.
Solution
Long story short, you need to terminate the Elastic Beanstalk environment instead, as illustrated in section Step 6: Clean Up within the AWS Elastic Beanstalk Walkthrough (there is a dedicated section for the Elastic Beanstalk service within the AWS Management Console).
You can also do this via Visual Studio, as explained in step 11 at the bottom of How to Deploy the PetBoard Application Using AWS Elastic Beanstalk:
To delete the deployment, expand the Elastic Beanstalk node in AWS
Explorer, and then right-click the subnode for the deployment. Click
Delete. AWS Elastic Beanstalk will begin the deletion process, which
may take a few minutes. If you specified an notification email address
the deployment, AWS Elastic Beanstalk will send status notifications
for the delete process to this address.

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.