Rare scenario in DevOps - using jenkins - amazon-web-services

I have new to aws and jenkins. I have a scenario as below.
We have an aws AMI which has jenkins installed in it. The AMI is a Linux platform. We already have few jobs set in the AMI for code bases (PHP and Python) for Development and QA environment.
Now that we have a new framework in .net which is again a part of the same project done in PHP. These are windows services written in .net.
Right now the deployment are performed manually. We pull the code and build the code in the same machine. So we take care of stop/starting the services manually during this process on the Windows AMI dedicated for this testing. We would like to create a job (build and deploy) as we do for python and PHP.
The challenge is that we want to build the code on the Windows AMI and the jenkins in running on Linux AMI.
Is there a way to establish a connection between the AMI's running in different operating systems in aws.
Should we install powershell in windows to have ssh access. In that case we can establish a connection from Linux AMI to Windows AMI and then execute a .bat to do the rest of activities.
** We are specifically asked not to install another jenkins in Windows system since we want to maintain all the jobs in a single place and single server.

Its not actually a very rare scenario. Its not uncommon to have Jenkins running on Linux and also have the need to build and deploy windows applications using it.
Lucky for you Jenkins handles this quite easily using the concept of a master/slave architecture, where in your case the master node will be your primary Jenkins install running on Linux and you will setup one or more 'slave' instances running windows and the jenkins agent that allows the two to coordinate.
Its all explained here:
https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds

Related

Install software on multiple ec2 instances along with json file

I need to install Fire Eye in multiple ec2 instances in my AWS account, all running Windows Server 2012. I have the installer msi and could do it using Distributor in SSM. However there is a json file that needs to be in the same folder as the msi file when software is being installed. This doesn't seem to be supported by Distributor.
Can anyone help me out with how this can be done, short of logging in to every server and installing it manually after copy pasting the json and msi file in one folder?
Usually for ad-hoc execution of commands on a fleet of instances you would use AWS Systems Manager Run Command:
Administrators use Run Command to perform the following types of tasks on their managed instances: install or bootstrap applications, build a deployment pipeline, capture log files when an instance is terminated from an Auto Scaling group, and join instances to a Windows domain, to name a few.

How to install software on multiple aws ec2 instances?

I created multiple (say 16) AWS EC2 ubuntu instances such as:
I want to keep these instances to have the same settings for later jobs. My question is how I could manage them jointly. For example, how could I install Docker in all of them at once and so that I can use docker swarm?
Ideally you would actually configure the server build before you deploy the 16 instances.
You would launch a fresh Ubuntu server and install all of the software on it with its configuration. Once all software is installed you'd create an AMI. When you go to launch the 16 servers you'd go ahead with launching them from your AMI instead of the Ubuntu image.
To follow best practices you'd not do this installation by hand, instead using a configuration automation tool such as Ansible, Chef or Puppet to configure the server to your liking.
You can make use of aws user data to install same software on all the instance during ec2 creation.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html

Dynamically update AMI

I have a question regarding AWS, have an AMI with windows server installed, IIS installed, and a site up and running.
My AutoScale always maintains two instances created based on this AMI.
However, whenever I need to change something on the site I need to upload a new instance, make the changes, update the AMI and update the auto-scale, which is quite time consuming.
Is there any way to automate this by linking to a Git repository?
This is more like a CI CD work rather than achieved in AWS.
You can schedule a CI CD pipeline to detect any update happens in SCM(GIT) and trigger a build job(Jenkins or similar tool) which will provide an artifact to you. You can deploy the artifact to respective application server using CD tools (ansible/even with jenkins or similar tools) whichever suits your infra. In the deploy script itself you can connect to ec2 service to create a new AMI once deployment is completed.
You need to use set of tools to achieve it SCM webhook/poll, Jenkins, Ansible.

Which build server and code scan tool to use on AWS EC2 Windows instance?

I have to implement Code Scan tool in CI/CD pipeline in AWS. I have an EC2 Windows Instance.
I checked few tutorials and found some plugins with Jenkins but these all samples are in Linux.
I want to know how to install Jenkins or any other alternative in EC2 Windowsand which code scan tool to use in this environment?
You can follow How to Install Jenkins on Windows tutorial to see how you can use Jenkins on windows.
Alternative to Jenkins is Atlassian Bamboo which is widely used as well for CI/CD
Some of the widely used code scan tools are
Checkmarx
Sonarqube
IBM Appscan - Commercial

Using the vSphere SDK to run a script on a host

I've written applications making use of the vCloud SDK in the past, and it provided the ability to provide a guest customization script that would be run on the VM when you provisioned. This let me automate VM provisioning from code along with a few per-host customizations, which was great. Since these VMs were running on ESXi, this told me that passing in a script to be run on the VM was a capability of ESXi and the VMWare Tools.
Now I'm working with the vSphere SDK, and I can't a similar capability anywhere. I want to be able to provide a script to my hosts that joins them to my domain, but I can't figure a way to pass a script that does this from the SDK. Is this possible? Or is this capability somehow unique to vCloud?