I'm running a web server app in ElasticBeanstalk, using single Docker container config. I want to retrieve the current Running Version of the ElasticBeanstalk App somehow. I hoped there will be predefined environment variables from EB but there are none that could help.
Is there a programatic way to retrieve it from within the container?
EB CLI: you can use EB CLI for this. "eb status" command will list out the status of your current EBS app. You can filter your required parameters from the output.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cmd-commands.html
AWS API: You can also use "DescribeApplicationVersions" in AWS API to get the version.
http://docs.aws.amazon.com/elasticbeanstalk/latest/api/API_Operations.html
Basically you would need to upload the script or program in your docker container and run it for the container. Invoke the script in your dockerfile so that it does your job.
Related
Here is my setup.
My Django code is hosted on Github
I have docker setup in my EC2 Instance
My deployment process is manual. I have to run git pull, docker build and docker run on every single code change. I am using a dockerservice account to perform this step.
How do I automate step 3 with AWS code deploy or something similar.
Every example I am seeing on the internet involves ECS, Fargate which I am not ready to use yet
Check this out on how to Use Docker Images from a Private Registry (eg. dockerhub) for Your Build Environment
How to Use Docker Images from a Private Registry for Your Build Environment
I have a large, multi-component django application I am trying to deploy to elastic beanstalk. I am using the multi-docker environment. THis is my current workflow
Git commit triggers AWS code pipeline
AWS Codebuild builds docker image (docker-compose build), runs some tests, and pushes this image to AWS Elastic Container Registry
AWS Code Build calls eb deploy
The issue I am running into is that when I call eb deploy from my local box, the it simply upgrades the application, but when I call it from Code Build, it is upgrading the environment every time, which takes about 30 minutes for some reason
I run the deploy command with -v and confirmed that the same files are being zipped. Any ideas on what is going on here, is my setup incorrect?
I also tried to deploy the application from Code Deploy in the pipeline and can confirm that it also always upgrades the entire environement.
I think that if you use CB to update your EB env, it just replaces it as it is being considered as a new environment. In your local workstation you are using only one single environment, but with new application version.
I would consider replacing CB for updating your EB environment, with the EB deploy provider in your CP. This should successful just upload your new application version to an existing EB environment.
CP natively supports a number of deploy action providers, one of the being Elastic Beanstalk:
You can configure CodePipeline to use Elastic Beanstalk to deploy your code. You can create the Elastic Beanstalk application and environment to use in a deploy action in a stage either before you create the pipeline or when you use the Create Pipeline wizard.
I have a working Elastic Beanstalk environment(PHP 7.3).
The ec2 uses Amazon linux2.
I now have to run some userdata ( yum install ... , curl ...) on these ec2 before they start.
Is this possible ?
I wish userdata was included in Launch configuration.
Can any provide some guidance here.
Just as an FYI, I am using cloudformation.
Thanks !
You can't directly modify UserData that EB is using on its instances, as the UserData is constructed by the EB service based on your setup. You can access it and view it, but can't modify from the CloudFormation level.
There are few options that could potentially server your purpose, depending on your exact needs:
User Resources section in your .ebextensions to add CloudFormation code to the template that EB is generating.
Create custom AMI to use in place of those provided by EB. This way you can set them up and fine tune to your requirements.
Use .ebextensions and platform hooks to install extra software or curl webservices you need.
Hope this helps.
I have a release of my project. I build a docker image and deploy it on an ec2 instance.
Later, when I have a new release, I would like update the docker on ec2 remotely (without accessing the machine, just executing some service).
Is there a way how to do it without ECS and ElasticBeanstalk?
If it's not possible can I somehow re-run the cfn-init script?
My Research
https://aws.amazon.com/blogs/aws/new-ec2-run-command-remote-instance-management-at-scale/
You can manage your instances remotely (i.e. make changes without manually SSHing into the instance and typing commands) by using any of the many system management services out there. AWS offers Simple Systems Manager (SSM) of which the Run Command you linked is part. AWS also offers the OpsWorks service which uses Chef. You also have other products like Ansible and SaltStack, and you can optionally integrate the use of those services with the AWS SSM service.
I currently have an elastic beanstalk application using ebextensions.
It works great when the application is deployed for the first time but I want to be able to run the ebextension scripts again without redeploying.
I attempted to re-run the ebextension scripts from the aws cli.
Neither
aws elasticbeanstalk restart-app-server
aws elasticbeanstalk update-environment
seem to re-run the ebextensions scripts.
The files under .ebextensions are not retained after the deployment, so you'll need to redeploy to run them again. That being said, if you need the functionality outside of the deployment activity, you might want to implement it in another way.