Is it possible to use AWS CodePipeline with Lightsail?
Asked Answered
C

4

8

I'm working all the day and couldn't find the answer. So I'm asking you guys: is it possible to use AWS Pipeline with AWS Lightsail?

My objective is to store the code inside CodeCommit and use CodeBuild, CodeDeploy, CodePipeline and S3 to create a Continuous Deployment inside a Lightsail instance.

Those are the steps I think I have to follow to accomplish the task:

[x] setup a Lightsail instance
[x] create an IAM user and set permissions
[x] transfer my repository to CodeCommit
[x] create an S3 bucket to hold the build artifacts
[x] create a CodeBuild project to build the artifacts
[x] create a buildspec.yml file with my build steps
[ ] create a CodeDeploy project to deploy my application
[ ] create a CodePipeline project to trigger the build when I commit to certain branch

As you can see, I'm almost there. But I couldn't find any way to use my Lightsail instance with CodeDeploy. So, my question is: is it possible? Is there some limitation? Did I miss something really basic? Is there any other way to make the CD with Lighsail? Sorry, I'm getting a little crazy right here ahhaha.

Causeway answered 14/8, 2017 at 20:5 Comment(3)
Can you try connecting the LightSail VPC to an AWS account VPC through peering and then proceeding with codepipeline. I haven't tried this but I presume it should work.Metralgia
I followed these instructions lightsail.aws.amazon.com/ls/docs/how-to/article/… and tried to put a tag to the VPC and the Peering Connection but even with that, CodeBuild couldn't find the instance.Causeway
If it is any consolation, the CloudWatch Agent also does not work with LightSail.Gravelblind
C
3

Today, 08/16/2017, it's not possible to integrate them.

I asked the same question on AWS forums and they replied that those technologies are not integrated yet since they are separated from each other.

Well I guess I'll have to find another way.

Causeway answered 16/8, 2017 at 20:3 Comment(6)
It's true that AWS CodeDeploy does not integrate with Lightsail. However, I would bet that you could set up CodeDeploy deployment groups for Lightsail by setting them up as on-premises instances. It's not ideal, but it could be done. I don't know how that plays with CodePipeline.Calcimine
I considered to use on-premises instances, but it seems that they are outside the Lightsail plan and are changed separatelly. That's a restriction since my client don't want that cost (specially because it will not be directly related to the application itself).Causeway
An "on-premise instance" can be anything. It can be your own server, a Raspberry Pi, an EC2 instance, or whatever. You just need to install the agent and configure it properly. I'm sure Lightsail can be set up to be an on-premise instance with CodeDeploy.Calcimine
Yes, I'm sure it can. But as I said the problem is the not-planned not-directly-related-to-the-application cost my client don't want to have (as minimum as it can be). If I had the choice I would use it.Causeway
Ok, I understand your point. AWS CodeDeploy does cost $0.02 per update for on-premise hosts.Calcimine
LightSail is billed under the owning account. It is treated as an isolated VPC w/ limited functionality to decrease the blast radius when someone leaves port 22 open and removes the requirement for a key. If it is any consolation, I spent an entire day trying to get the CloudWatch Agent to work on a LightSail instance but it does not. No matter if it is set to 'on-prem' or not.Gravelblind
P
3

i’m not a total expert here, but I think the way to do it would be with a custom script in CodeBuild, rather than with CodeDeploy.

CodeDeploy has a lot of custom stuff going on to support rollbacks and that sorr of advanced stuff (means you have to install the agent on your target server etc).

CodeBuild is just made for running scripts, so I think it’d be reasonable to add a deploy script (that runs after your tests) that connects up to yor Lightsail instance via SSH and deploy any changed files (similar to how you’d do it in open source using Travis CI etc).

Specifically I’ve used the dploy package on npm to do the actual SFTP upload before. It’s Git-aware so it only uploads changes since the last revision (but you could just rsync if you didn’t care about that).

Prau answered 10/3, 2019 at 23:6 Comment(0)
F
2

I recently had the same challenge and got it working.

It is necessary to register the Lightsail Instance as an on-premise instance with CodeDeploy. On the instance itself the CodeDeploy agent needs to be installed and configured.

I have written a post about how to set this up on my blog.

Fabrianna answered 16/5, 2019 at 11:33 Comment(2)
404: Page not found, for the link you gaveFuge
Correct Link: scratchpad.blog/howto/how-to-use-codedeploy-with-aws-lightsailRodi
P
0

https://scratchpad.blog/howto/how-to-use-codedeploy-with-aws-lightsail/

Following those steps can help you deploy lightsail as an onpremises instance and you configure codedeploy to deploy to the onpremises instance

Philanthropic answered 26/4, 2020 at 18:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.