I have a docker container running on AWS EC2. I am able to ssh into EC2 and edit the code running in the container, the problem is that those changes are not reflected on the respective website. It behaves like there is some kind of caching taking place with EC2 but can't find any caching going on. How do I get those changes to take effect? I am at a loss; any help is greatly appreciated.
Related
I hope somebody can direct to the best approach to solve this matter.
I have an azure account on which I have an azure container registry holding my docker images. Just for personal education purpose I want to try and deploy one of azure docker images into a aws ec2 instance.
Reading some aws documentation, I understand that I need to create a ecr container and with azure DevOps, using the service connection to build and deploy the docker images to ecr, this seems to be pretty straight forward. But after this step its plain darkness as I cannot find a best approach on how to implement a continuous delivery every time there is a new docker image in my ecr.
One of the solutions I thought and found, is to install an azure DevOps agent on the ec2 to run a docker pull but I am not 100% sure about if this is the best approach.
So I am asking to you experts to enlighten me about this and I do apology for the basic question.
Thank you so much in advance for any help you can provide, and please if my question is not 100% clear, do not hesitate to ask more infos.
You should be able to authenticate to your Azure Container Registry instance from EC2 using standard docker login command. You do not even need Azure DevOps agent for that, since you should be able to configure regular service principal with set of standard docker registry credentials.
Then you can pull and use your images normally.
It is absolutely not required to replicate your images in the ECR.
Unless you want to do full ECS. Use a shell script to do what you would do manually on the EC2 command line.
Im looking for some advice, this may seem like a silly question but I am having some issues with understanding how AWS EBS autoscaling works and its best practices.
I have a laravel application that is deployed to AWS EBS through bitbucket pipelines. This all works and deploys successfully.
My issue is when the autoscaling triggers it then brings up a new EC2 instance and then load balances the traffic. The problem is that the new EC2 instance in the fleet is a blank AWS Linux2 AMI so just shows the nginx welcome page.
I think the issue is that it's using a blank AMI and not getting my application. I am guessing i could create an image from the EC2 image running my application and then scale with that but i would have to do that every time i do a deployment.
Can you configure the auto scaling group to replicate the running EC2 instance?
Any help or advice as to the best way to accomplish autoscaling with my application would be great.
Its depend on the AMI selected in Launch Configuration..
You need to create AMI of your live EC2 instance after you updated your all required softwares, dbs, configurations and verified(tested) for proper work..
then add this AMI to Auto scale Launch Configuration..
you dont need to create AMI for each deployment..
Whenever you makes changes On Ec2 server , or updates your app source code, you need to create new AMI and need to specify that AMI in Autoscale launch configuration.
best practice is to config the auto scale with a user data script. So when the new AMI boots up during the auto scaling it reads the user data (cloud init/upstart). The user data script can pull the code from the git or what ever source control and run the necessary pre-deployment commands.
I am trying to use a custom AMI in AWS Beanstalk. I manually launched a default Amazon ElasticBeanstalk image in EC2 (ElasticBeanstalk-Tomcat7-32bit-20110913-1132 (ami-278e4c4e)) and created my custom AMI from that. I then go to ElasticBeanstalk, launch an Environment and once it's up and running, I switch to this custom AMI in the Environment's configuration.
The health status is green. But my webapp does not get deployed on the instance:
[root#ip-***-***-***-*** ~]# ls -l /opt/tomcat7/webapps
total 0
Tomcat is running:
[root#ip-***-***-***-*** ~]# /etc/init.d/tomcat7 status
Tomcat 7 is running.
I am puzzled about why my app does not get deployed. Does anyone know what's going wrong?
well, the Beanstalk AMIs use a init script to copy your application from S3, and deploy it to the container (Tomcat).
I would recommend:
1. Take a look on CloudInit logs at: /var/log/cloud-init.log.
2. If everything looks fine (or even empty), edit the script at /etc/sysconfig/cloudinit to add some traces just to check if the CloudInit script is executed, or is failing at some point.
I'm sorry no being able to give you a better help, but is hard from here to know what is happening!
What I normally do, is launch a Beanstalk Instance (not a Instance with a Beanstalk AMI), then I do the modifications on that instance, and to finish I create my custom AMI to do what you are trying to achieve.
I meanwhile figured out the problem. When you create your own AMI from one of the Amazon predefined Beanstalk images, and you don't actually make any changes to the file system (install anything, create files, etc.), AWS will NOT create a new snapshot while creating a custom AMI. The created AMI will not work in Beanstalk then.
As long as you make any changes to the default image before you create your own custom AMI, everything should work fine.
I am working on a HDFS high availability project.
I have configured Hadoop on one Amazon EC2 instance. It is small instance (AMI: Ubuntu server)
I want to form a cluster of EC2 instances. So, i am thinking of replicating the same machine. Does anybody have a clue about how to duplicate this instance on another instance of EC2. If yes, please share.
Thanks!
If your instance is EBS backed, you can make a snapshot and then run as many instance as you want from it.
As I want to install Jenkins (ex-Hudson) to operate my continuous integration processes on AWS Beanstalk, I need a custom AMI because some parameters in Tomcat & Linux have to be changed for Jenkins
I run the process of installing and customizing the instance started initially by Beanstalk until the end and Jenkins works like a charm on it.
But, what I can't do is reuse the AMI that I generated at the end of my customization: the health check done by BeansTalk doesn't see the EC2 instance although Beanstalk started it and it works fine.
In order to understand my issue, I reduced my failing process to the following:
a) I create a new BT application / environment based on sample provided by Amazon (only parameter that I had is a keypair to SSH my EC2 instance)
b) when the EC2 instance is started, I use the EC2 to flash the AMI
c) I modify the BT env config by changing the original AWS Ami (id: 100fff79 - Tomcat 6 64 bits) by the 1 that I genrated in (b)
d) the BT rebuilds when I change the ami id
e) the rebuild restarts the EC2 instance.
f) It starts fine (can ssh to it) but the health checking fails and my env turns to red status.
Can somebody replicate this process and tell me what I am doing wrong ?
(I would like to use the AMI of (b) as starting point for my Jenkins customization.?
Additional info that I can provide:
when ssh-ing to the EC2 instance, a grep for apache, java, thin & bluepilld as described at bottom of https://forums.aws.amazon.com/thread.jspa?threadID=59027&tstart=25 shows that the 4 expected processes disappeared. Hence, the failure.
Please, help !
regards
didier
will answer my own question: the right way to obtain a working customized ami for Beanstalk is not to try to flash a running instance launched by Beanstalk but rather start the template ami for Beanstalk (ami-100fff79 for Tomcat 6 64 bits in my case) from EC2 console and customize it from there, flash it and you're done.
You can then "edit configuration" for your BT environment by changing the ami to the new one and it works fine.
regards
didier
If you give more details, this is a feature I'm planning for version 0.3.0 of Beanstalker, my set of Maven plugins for automating maven deployments to Elastic Beanstalk and Elastic MapReduce. It is available at http://beanstalker.ingenieux.com.br/
Actually, the placeholders are there, but I haven't still done full testing of that. Are you willing to try and give help and advice?
You should be able to create a customized AMI from a running instance as long as you delete /opt/elasticbeanstalk/srv/hostmanager/db/hostmanager.db on the instance before building the new AMI. I keep seeing people say "it can't be done, you need to start a clean instance outside of Elastic Beanstalk" and that's bunk. I've done it.
A full write-up of what I've done to customize my install is here: http://stormerider.com/blog/2012/08/16/building-an-ubuntu-ami-with-elastic-beanstalk-support/ -- some of it may not apply to you, some of it may.