Category Archives: Cloud

How to create an Amazon Machine Image

You can create an Amazon Machine Image or AMI for your existing EC2 instance. The AMI will allow you to launch a fresh EC2 instance using the AMI as a template. You can also share the AMI with other AWS accounts.

Step 1

To get started, it is best practise to stop your instance before you start. So right click your instance and click stop

Step 2

When the instance has stopped, right click it again, click image and then create Image

Step 3

Give your Image a name, a description and then click create Image

Step 4

In the screen that appears click the ami ID.



Step 5

You will now see your image creation as pending.

Step 6

Once the ami is marked as available you can then launch it as an EC2 instance.

A full video tutorial can be found here:

How to Create a VPC on AWS with public and private subnets

A virtual private cloud (VPC) is an on-demand configurable pool of shared computing resources allocated within a public cloud environment, providing a certain level of isolation between the different organizations (denoted as users hereafter) using the resources. The isolation between one VPC user and all other users of the same cloud (other VPC users as well as other public cloud users) is achieved normally through allocation of a private IP subnet and a virtual communication construct (such as a VLAN or a set of encrypted communication channels) per user

In this tutorial we will show you how to create a VPC in AWS with a public and private subnet.

Step 1

Log into the aws console, click services and then VPC.

Step 2

Next click Elastic Ips on the left hand side


Step 3

Click to allocate new address.

Step 4

Click allocate and then close.

Step 5

Click VPC Dashboad in the upper left to go back to the VPC dashboard.

Step 6

Click launch VPC Wizard

Step 7

Click VPC with Public and Private Subnets and click select.

Step 8

Enter values relevant to you and then click create VPC

After you click create you should see the VPC creating, note, it may take several minutes for the NAT gateway to create.

You should then see a message that states the VPC is created.

A full video tutorial can be seen here:

How To Create a S3 Bucket

This AWS tutorial will show you how to create a S3 bucket on AWS.

“Amazon S3 or Amazon Simple Storage Service is a “simple storage service” offered by Amazon Web Services (AWS) that provides object storage through a web service interface. Simply, Amazon S3 provides a web interface to easily store and retrieve data safely, in any amount, at any time, from anywhere, at a low cost. Amazon S3 uses the same scalable storage infrastructure that Amazon.com uses to run its global e-commerce network.”

Step 1

Log into you AWS account click services and then s3

Step 2

In the screen that appears click create bucket

Step 3

Give your bucket a unique name (It most be unique across all of AWS) then click Create in the lower left.

Step 4

You should now see your bucket, click it to access it.

Step 5

Click upload, to add a file.

Step 6

Click add file & navigate to a file on your machine to upload.

Step 7

Click upload to upload your file.

You should now see your file in your bucket:

 

A full video tutorial can be found here:

How to Setup CentOS 7 on AWS

This tutorial will show you how to create a CentOS 7 instance on AWS. We assume that you already have you AWS account created and that you are logged in already.

Step 1

Click Services and then EC2

Step 2

Click Launch Instance

Step 3

  • Click AWS Marketplace
  • Search for CentOS
  • Select the top result – CentOS7

Step 4

Click Continue

Step 5

Select your machine type and click Next Configure Instance details. In our case we will select the t2.micro instance as it is free tier eligible.

Step 6

Change Auto-assign public IP to Enable and click Next: Add storage.

Step 7

Leave the defaults and click Next:Add Tags

Step 8

Click Next: Configure Security Group

Step 9

Click review and Launch.

Step 10

Review your settings and then click Launch.

Step 11

In the drop down menu select create a new key pair, give the key pair a name and Download the Key Pair, then click launch Instances.

Step 12

Click your instance ID to see the instance.

You should now see your instance.

Step 13

To connect to our instance we will need to convert the key we downloaded, to do so we will use putty and puttygen they can be downloaded form here: https://www.putty.org/

Open puttygen and click Load

Step 14

Navigate to where you downloaded your key, click all files, click on your key and click open.

Step 15

Now click Save Private key, when prompted click yes you want to save without a passphrase.

Step 16

Now open putty and enter your public IP into the host name or IP address field, then expand SSH on the left had side.

Step 17

Click auth and then browse, navigate to where you saved your key and select it.

Step 18

Now click open

Step 19

Click Yes

Step 20

Enter centos as the username and click enter.

You will now be logged in

A full video tutorial can be found here:

How To Install Own Cloud on CentOS 7

This video shows how to install Own Cloud on Centos. Own Cloud is simailr to dropbox but you install it on your own server which gives you full control over your data. There are several prerequisites needed to follow along with this video, which I have also included below.

Firstly the commands needed are:

sudo rpm –import https://download.owncloud.org/download/repositories/stable/CentOS_7/repodata/repomd.xml.key

 

sudo curl -L https://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo -o /etc/yum.repos.d/ownCloud.repo

 

sudo yum clean expire-cache

 

sudo yum install owncloud

 

sudo mysql -u root -p

 

CREATE DATABASE owncloud;

 

GRANT ALL ON owncloud.* to ‘owncloud’@’localhost’ IDENTIFIED BY ‘password123’;

 

FLUSH PRIVILEGES

 

exit

 

sudo setenforce 0

 

How To Install Own Cloud on CentOS 7:

 

 

How To Install Apache (HTTPD) On CentOs7:

How to download and install MariaDB (MySQL) on centos 7:

 

How to set up Lets Encrypt on CentOS 7

How To Disable SELinux on CentOS 7

Get list of running instances in AWS emailed to you daily.

Say you share an AWS account with a few people and you’re the bill payer. You’d like to keep an eye on the running instances, but logging in each day to check can get tiring, especially if you are out and about and can’t get near a PC. A handy way to get the instances is to have a script running that gathers the instances and emails them to you. The below script does just that. Before you set up this script you will need set up AWS command line tools on your server. You can see how to to this in the blog post here.

 

 

 

#This is a bash script to get running instances from AWS and mail them on to the  relevent people

 

printf “Hi there,\n I am a bot so please don’t reply to me all I do is list  active EC2 instances in your AWS account! \n if my findings appear wrong please contact Darren In IT and he will ensure that they are corrected \n Running

 

Instances in EU-West-1 \n” > FileToBeMailed.txt

 

aws ec2 describe-instances –query ‘Reservations[*].Instances[*].[InstanceId]’ –filters Name=instance-state-name,Values=running –output text –region eu-west- 1 >> FileToBeMailed.txt

 

printf “\n Running Instance in us-east-1\n” >>FileToBeMailed.txt

 

aws ec2 describe-instances –query ‘Reservations[*].Instances[*].[InstanceId]’ –filters Name=instance-state-name,Values=running –output text –region us-east-1 >> FileToBeMailed.txt

 

printf “\n Running Instance in us-west-2\n” >> FileToBeMailed.txt

 

aws ec2 describe-instances –query ‘Reservations[*].Instances[*].[InstanceId]’ –filters Name=instance-state-name,Values=running –output text –region us-west- 2 >> FileToBeMailed.txt

 

printf “\n Running Instance in ap-northeast-2\n” >> FileToBeMailed.txt

 

aws ec2 describe-instances –query ‘Reservations[*].Instances[*].[InstanceId]’ –filters Name=instance-state-name,Values=running –output text –region ap-northeast-2 >> FileToBeMailed.txt

 

printf “\n Running Instance in ap-southeast-1\n” >> FileToBeMailed.txt

 

aws ec2 describe-instances –query ‘Reservations[*].Instances[*].[InstanceId]’ –filters Name=instance-state-name,Values=running –output text –region ap-southeast-1 >> FileToBeMailed.txt

 

printf “\n Running Instance in ap-southeast-2 \n” >> FileToBeMailed.txt

 

aws ec2 describe-instances –query ‘Reservations[*].Instances[*].[InstanceId]’ –filters Name=instance-state-name,Values=running –output text –region ap-southeast-2 >> FileToBeMailed.txt

 

printf “\n Running Instance in ap-northeast-1\n” >> FileToBeMailed.txt

 

aws ec2 describe-instances –query ‘Reservations[*].Instances[*].[InstanceId]’ –filters Name=instance-state-name,Values=running –output text –region ap-northeast-1 >> FileToBeMailed.txt

 

printf “\n Running Instance in eu-central-1 \n” >> FileToBeMailed.txt

 

aws ec2 describe-instances –query ‘Reservations[*].Instances[*].[InstanceId]’ –filters Name=instance-state-name,Values=running –output text –region eu-central-1 >> FileToBeMailed.txt

 

printf “\n I will mail again tomorrow with am updated list of instances” >> FileToBeMailed.txt

 

 

First we start of by typing the text we want to head our email. Here we state that we are a bot and that if there are any issues contact Darren who created the bot. The  “ \n “ that you see telling the script to start a new line. We then state what will be the first region that we will get details for by writing “\n Running Instances in EU-West-1 \. Once we have finished this paragraph we direct the output to a file called FileToBeMailed.txt

 

Next we start by issuing our AWS commands, basically, what we are saying here is get all the running instances in eu-west-1 and then append them to the end of the FileToBeMailed.txt. We do this for each AWS region, each time appending to the end of the FileToBeMailed.txt. This builds up the list of running instances that we can see. When we have listed all the instances we print that we will mail again tomorrow with the instances.

 

Now that we have the file produced we just need to send the contents of this file to an email account of our choice. To do this we can use send mail and is discussed in the post here that details how to use send mail to send emails to your own account.

 

How to access Amazon Web Services (AWS) via the command line from Linux.

Introduction

 

AWS provide command line tools that are extremely powerful. These tools allow you to administer your AWS account. The tutorial below details how you can connect a Linux machine to your AWS account. There are two portions to this tutorial:

 

  1. Set up your AWS account to allow access from the command line.
  2. Installing the AWS command line tools on your machine and configuring it to access AWS.

Part 1. Setting up AWS to allow access from the command line.

 

Step 1.

 

Log into your AWS account.

 

Step 2.

 

Next click your user name, and in the menu that appears select “Security Credentials”.

 

Step 3.

 

In the screen that appears select “Users”.

Step 4.

 

Next click “Create new users”.

 

Step 5.

 

Give your account a name and insure that you have the check box ticked that states “Generate an access key for each user”. Then click “Create”.

Step 6.

 

In the screen that appears select “Downloads Credentials”. Be sure to take note of where the file saves to as we will need it later.

Step 7.

 

Click back to users and click on the user you have created.

Step 8.

 

Next click “Permissions” and the then “attach policy”.

 

 

Step 9.

 

Select the checkbox besides “Administrator Access” and click “Attach Policy”.

This completes the part of the tutorial that takes place on the AWS console. Next go to your Linux machine and open a terminal.

 

Part 2: Installing and configuring AWS CLI on your Linux machine.

 

We will first need to install PIP which will allow use to install the AWS CLI utility.

 

Step 1.

 

Type the command “curl -O https://bootstrap.pypa.io/get-pip.py” into the termainl

 

Step 2.

 

Next, type “sudo python get-pip.py” and hit the enter key.

 

Step 3.

 

Next run, “pip install awscli”

 

The AWS command line utility should now be installed. Now we need to configure the CLI so we can access our AWS account

 

Step 4.

 

Type “aws configure” into the termainl and press enter. You will now be promoted to enter the following information:

  • AWS Access KEY ID
  • AWS Secret Access Key
  • Default region name
  • Default output format

Enter your details from the CSV file that you saved.

You are now connected to the AWS via the command line!