By using AWS re:Post, you agree to the Terms of Use

Codedeploy to server farm - high level understanding and confirmation


Morning all, I want to confirm I am on the right track and just logically trying to put things in order. I have a group of servers that are quite static (no need for autoscaling). It's a java app, and Beanstalk doesn't support the app. So right now the developer is going to each server via custom ports to undeploy and deploy new apps. The farm has grown and its time consuming. Some of the reading is a bit confusing, so for a quick high level, I had these questions/help items. Using the left side nav from codecommit,

Under Source

  • its always just one file (a .war file). so regardless, I believe I will need to use either GIT/CodeCommit and can't just have the developer upload a file to an S3 bucket right? That would enable the version control, revert, etc.

Under Deploy

  • Applications - I have created the application, service role, type and configuration (by key/value). Also have the enable load balancing checked with a test group (one server right now).

I don't think I really need to worry about the artifacts or the build, all I want is for the developer to finish his WAR file, commit. So not sure what is the magic that after I he commits, it takes that code, then push's to the servers. The agent is installed and just not sure if I need a pipeline setup, or there is something between the deploy and the agent and a simple answer here may prove much faster than other resources.

So thank you again for the feedback and/or suggestions if there is a better way but think once setup this really is quite simple.

asked 8 months ago419 views
2 Answers

I recommend you to use AWS CodePipeline ( a service similar to Jenkins), which cost $1 monthly per active pipeline.

In theory, with CodePipeline you don't need CodeCommit you can use S3 as source.

Ideally you should only checkin your source code, then use CodeBuild to build an artifact (WAR for example).

However if you decide to directly push WAR for now, S3 might be a better choice.

After Checkin / upload to S3, the CodePipeline can be configured to either going through a build process (in case of a source file) or directly deploy and configure the artifact to target environment (EC2 or otherwise) through a deployment provider, such as CodeDeploy.

answered 8 months ago

Thanks @Jason -

Edited this after more reading and understanding ... The basic flow works like this and this is my current status;

  1. code is pushed (I am testing with 2 files, the WAR and the appspec.yaml file). From the CLI;

aws deploy push —application-name name —description “iniital test” —ignore-hidden-files —s3-location s3://bucket/folder/ —source .

After that, I had the single file in that S3 bucket

Npw step 2 is to use codedeploy (or another method) to get that down to the server. I like CodeDeploy as I can do a one at a time (not sure if I can with pipeline), but from the console, when I tried, it just kept spinning. I had the code-deploy agent installed (manually from an earlier test), so removed it and said allow SSM to install. That machine should have the permissions via IAM-Roles. But after the timeout, the error is "CodeDeploy agent was not able to receive the lifecycle event. Check the CodeDeploy agent logs on your host and make sure the agent is running and can connect to the CodeDeploy server."

However code-deploy is not running, so I assume its an issue with SSM permissions not being allowed to run there? So, I can continue this, OR as you suggested code pipeline (if it can do the same one at a time), however the bigger picture is the apppec file as that has the where to put and what commands to run after.

Remember this is a single file and source control is not needed as we keep the olders in a sub folder, so really would be perfect if he dropped a file in a folder (new), something like codepipeline fired, which put the file in the right place and ran the scripts to do (which are on an EFS). So I was even looking at eventbridge, but really need that one at a time feature.

Thank you again.

answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions