I have project in bitbucket that I want to deploy to ec2 instance in AWS . Here are the details :
1. I already have 1.2.3.4 ip address machine which hosts nodejs code , I have to manually ssh into this machine , do git pull origin main and then restart pm2 command
2. I want to do #1 on every main branch commit .
Hi Prateek and welcome to the community!
You can use Bitbucket Pipelines for deployments. Since you want to deploy on every commit to main branch, you can use a pipeline that runs on the main branch:
You will need to set up SSH keys in Pipelines and the server for the connection:
You can then either use the ssh-run pipe to connect to your server via SSH and run commands:
Or, alternatively, you can use an SSH command in the yml file directly, if the steps' build container has an SSH client installed.
Please keep in mind that the server you want to connect to needs to have a public IP address so that Pipelines can reach it.
You could also run Pipelines builds with a self-hosted runner on a server of yours. We offer runners for Linux, Windows and Macos:
Please feel free to reach out if you have any questions.
Kind regards,
Theodora
Hi @prateek . In addition to @Theodora Boudale answer also you could try this pipe:
Deploy a new service configuration
script: - pipe: atlassian/aws-ecs-deploy:1.12.2 variables: AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY AWS_DEFAULT_REGION: 'us-east-1' CLUSTER_NAME: 'my-ecs-cluster' SERVICE_NAME: 'my-ecs-service' TASK_DEFINITION: 'task-definition.json'
Regards, Igor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.