Category Archives: Cloud

Jenkins email notifications using AWS SES

I have installed Jenkins on Amazon Linux EC2 instance and would like to setup notifications. Since AWS provides an email service, Simple Email Service (SES) that can accomplish this task. I can also use other SMTP providers such as Gmail, Outlook, Yahoo and Jango, but I like to keep everything in one environment.

SES in my AWS VPC was setup a while back, so I will use its settings.

Pre-requisite(s)

  1. AWS Account
  2. SES already configured (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/setting-up-email.html)
  3. SES SMTP credentials (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html)

Steps

  1. Access Jenkins
  2. Click “Manage Jenkins” then “Configure System”
  3. Scroll to “Jenkins Location” and input a “noreply” email address for “System Admin e-mail address. I used something like noreply@my.domain.***
  4. Scroll all the way down to “E-mail Notification” section
  5. Apply SES SMTP settings:
    • SMTP Server = email-smtp.us-east-1.amazonaws.com
    • Check box to “Use SMTP Authentication” and fill in required data:
      • User Name: {Use SMTP credentials created when setting up SES}
      • Password: {Use SMTP credentials created when setting up SES}
      • Check box for “Use SSL”
      • SMTP Port: 465
      • Add a “Reply-To Address”; in my case, I added the value used in step #3.
    • Click “Apply” to save settings
    • Check box to “Test configuration by sending test e-mail”
      • Test e-mail recipient: {your email address}
      • Click “Test Configuration” button
      • If successful, you will see “Email was successfully sent” message
    • Click “Save” button

***Without setting this value, an error will occur: “554 Message rejected: Email address is not verified. The following identities failed the check in region US-EAST-1: address not configured yet <nobody@nowhere>, nobody@nowhere

Install AWS CLI and AWS Python SDK – CentOS 7

The easiest method is to use pip as python is installed with Linux such as CentOS 7. This article covers only v2 of python only.

AWS CLI installation

  1. Download pip install script using curl: “curl -O https://bootstrap.pypa.io/get-pip.py
  2. Install pip using python: “python get-pip.py –user”
  3. Install AWS CLI using pip: “pip install awscli –upgrade –user”
  4. For successful installation, check version of the CLI: “aws –version”

AWS Python SDK installation

  1. Use pip to install boto3: “sudo pip install boto3”
  2. If a message appears stating that pip is not found, copy pip command from /root/.local/bin to /usr/bin
  3. Re-execute step 1

Credits: Amazon Web Services

http://docs.aws.amazon.com/cli/latest/userguide/awscli-install-linux.html#awscli-install-linux-pip

https://aws.amazon.com/sdk-for-python/

 

Using Vagrant on Windows 10

Step One – Installing Vagrant

  1. Download Vagrant
  1. Install after download completes.
  • This step assumes familiarity installing Windows applications.
  1. Reboot as informed by the installer.
  2. Launch PowerShell (Choose Run as Administrator)
  3. Install AWS-provider plugin:
  • vagrant plugin install vagrant-aws
  1. Create a project folder on root of C:\
  • mkdir project
  1. Run “vagrant init”
  2. Add dummy.box from Mitchell Hashimoto.

Step Two – Using Vagrant

  1. Use Scott Lowe’s blog on how use vagrant with AWS plugin.
  1. Create Vagrantfile and instances.yml similar to those of Scott Lowe’s github project.
  1. Since the Vagrantfile is looking in the user environment for AWS related key_id and secret_key, use set command to add this info to the environment:
  • set AWS_ACCESS_KEY_ID=
  • set AWS_SECRET_ACCESS_KEY=
  1. Customize instances.yml for your needs.
  2. Save files and run “vagrant up”.
  3. Check AWS Console under EC2 for running instance.
  4. Use Putty-gen to convert keypair.pem to keypair.ppk.
  • This step assumes familiarity with Putty.
  1. Setup a connection in Putty to connect to running instance.
  • This step assumes familiarity with Putty.
  1. SSH to instance using connection setup in previous step.
  2. Once done, run “vagrant destroy” to delete instance.
  3. Verify status of instance is “Terminated” on AWS Console.
  4. Logout of AWS Console.