Dealing with s3 using Python – Boto3 Module – Upload/Download files from bucket

We all know Amazon AWS, one of the AWS Features called s3, refer to Simple Storage Service which is is a service offered by Amazon Web Services that provides object storage through a web service interface.

Amazon Provide different ways to deal with s3, either by console or by AWSCLI, But In this post i choose to work with s3 in different way, as most of you know, i love python because it’s very simple, not complicated and cross-platform programming language.

You can deal and manage s3 using python by module called boto3, in previous version it was called boto (without 3), you have to install this module to allow python import the library, very simple step

pip3 install boto3

or by the project Interpreter that you are using, in my case i am using PyCharm Community, Nice to deal with, you can install any module by doing the following

File --> Setting --> Project interpreter --> Press on + sign --> and search for the module you want to install 

I uploaded the scripts to my Github like usual here, the repository includes two different file

  • Upload to S3
  • Download from s3

It’s very simple scripts, but you have to update the following to ensure access to AWS S3

Inside the upload file S3

  • ACCESS_KEY_ID
  • ACCESS_SECRET_KEY
  • BUCKET_NAME
  • The Location of the files

Inside the download from S3 file

  • ACCESS_KEY_ID
  • ACCESS_SECRET_KEY
  • BUCKET_NAME

Cheers ✌😉

Osama

Configure LB Using Nginx

Happy New Year Everyone

This is the first blog post for the 2020, i Wish everyone will have healthy and wonderful year, may your dreams come true.

I post recently or let’s say Last Year about Full automation project using DevOps tools, and i didn’t to be honest except that much download and questions on that post. you can read it from here.

I decided to create new project but this time to show the power of DevOps and how to use it more in your daily Job, task or even configuration.

The idea of this project like the following:-

  • You have two code, one Go based application, one Java-based application. Both are providing an HTTP service with the same endpoints.
  • The Endpoints which is :-
RouteDescription
/A static site. Should not appear in the final setup as it is but redirect to /hotels.
/hotelsJSON object containing hotel search results
/healthExposes the health status of the application
/readyReadiness probe
/metricsExposes metrics of the application

We have to setup Load Balancer for this application to be like the following :-

traffic distribution should be as follows: 70% of the requests are going to the application written in Go, 30% of the requests are going to the application written in Java, also i will do it using Docker

I upload the code, and the application ( the two part which is Go application and Java) to my Github HERE, all the configuration has been uploaded to my github,

The Solution files like the below;

  • docker-compose.yml file in root directory is the main compose file for setting up containers for all services
  • go-app directory contains binary of Golang Application and Dockerfile of relavant setup
  • java-app directory contains binary of Java Application and Dockerfile of relavant setup
  • load-balancer directory contains nginx.conf file which is configuration file of Nginx and have load balancer rules written in it. And containers a Dockerfile for setting up Nginx with defined configurations

The final architecture will be like this instead of the image you saw above

Enjoy And Happy New Year

Osama Mustafa (The Guy who known as OsamaOracle)

Complete Automation DevOps Project Deployed on kubernetes

## Problem definition

The aim of test is to create a simple HTTP service that stores and returns configurations that satisfy certain conditions. Since I love automating things, the service should be automatically deployed to kubernetes.

You can read more about the project, once you access to my GitHub using the README.MD, I explained the project step by step also the documentation explained every thing.

the code has been uploaded to GitHub, include to this, the documentation uploaded to Slide-share.

The code configuration here

The documentation here

Enjoy

Osama

Java Business Service/Siebel

Java Business Service (JBS) is a service framework that allows custom business services to be implemented in Java and run from a Siebel application.

If you have experience with java, you would likely to create Business service in java which you will find it easy.

Scenario: We wanted a business service to convert Gorgerin Time to Hijri Time, We did it in java then created a JBS then implement it in Siebel.

 

Steps :

  • Java Configuration in CFG.
  • Adding The required jar and jdk.
  • Creating the code and Exporting the jar file.
  • Creating Business service in Tools.

 

The following document discuss these steps in detais, you can access it here.

Cheers 🍻

Osama

Shell Scripting for begginers

Bash Scripting is one of the skills that any system adminsitrator or DBA’s should knows, why ? because it’s making your life much easier, for example, imagine you are about to change the persimisson of files for example under one directory, and inside it you have 10 files (i know it’s that much), Will you do it one by one, it will be a good idea, maybe you are fast typer but what if it will be more than 10 ?
Shell Scripting is the solution for this.

Bash is comamnd language and it’s widely available on various operating system, the name it’s self came from Bourne-Again SHell

Shell which is allows you for interactive or non-interactive execution.

Finally; which is scripting, the commands that will be executed one by one.

One of the simplest example which is “Hello World”, Save it as hello.sh

 

#!/bin/sh
echo “Hello, World”

if we need to modify this script to read name of the user; it will be like this :-

#!/bin/sh
echo “What is your name?”
read MY_NAME
echo “Hello, $MY_NAME”

Mathamtics examples :-

Shell Scripting can be used also in mathamtics operations such as the below:-

#!/bin/bash
((sum=25+35))
echo $sum
#!/bin/bash
((area =2*2))
echo $area

Looping :-

If you want to repeat something, then you should use either for or while which will make your life easier:-

The following example, will print the counter number each time, as you see the counter start from 5 and it will out once it will be 0

#!/bin/bash
for (( counter=5; counter>0; counter– ))
do
echo -n “$counter ”
done
printf “\n”

Using While but once it will be 5 the loop will be terminated.

#!/bin/bash
Bol_value=true
count=1
while [ $Bol_value ]
do
echo $count
if [ $count -eq 5 ];
then
break
fi
((count++))
done

 

Operator Description
-eq Checks if the value of two operands are equal or not; if yes, then the condition becomes true.
-ne Checks if the value of two operands are equal or not; if values are not equal, then the condition becomes true.
-gt Checks if the value of left operand is greater than the value of right operand; if yes, then the condition becomes true.
-lt Checks if the value of left operand is less than the value of right operand; if yes, then the condition becomes true.
-ge Checks if the value of left operand is greater than or equal to the value of right operand; if yes, then the condition becomes true
le Checks if the value of left operand is less than or equal to the value of right operand; if yes, then the condition becomes true.

 

If you want to learn more from here

Summary:-

  • Shell is a program which interprets user commands through CLI like Terminal.
  • Shell scripting is writing a series of command to execute.
  • Shell scripting can help you create complex programs

 

Cheers

Osama

Build, Deploy and Run Node Js Application on Azure using Docker

This documentation explains step by step how to Build, Deploy and Run Node.js application on Azure using docker.

The idea was when one of the customer asked to do the automatation  them, and they already had application written using node js, so i searched online since i can’t post the code of the client here and found this sample insteaed of using the actual code 😅

Now, the readers should have knowledge with Azure Cloud, but this document will guide to create and work on Azure therfore you have to understand Azure Cloud Concept, Also basic knowledge with node js and how to write docker file, the provided everything on my Github here, the code is already sample and used to deployed on heroku, but  still can be deployed on Azure using the documentation 🤔

The documentation uploaded to my Slideshare.net here

 

Cheers

Osama

 

 

Oracle Database Application Security Book

Finally …

The Book is alive

For the first time the book which is dicussed critcal security issues such as database threats, and how to void them, the book also include advance topics about Oracle internet directory, Oracle access manager and how to implement full cycle single sign on,

Focus on the security aspects of designing, building, and maintaining a secure Oracle Database application. Starting with data encryption, you will learn to work with transparent data, back-up, and networks. You will then go through the key principles of audits, where you will get to know more about identity preservation, policies and fine-grained audits. Moving on to virtual private databases, you’ll set up and configure a VPD to work in concert with other security features in Oracle, followed by tips on managing configuration drift, profiles, and default users.

What You Will Learn:- 

  • Work with Oracle Internet Directory using the command-line and the console.
  • Integrate Oracle Access Manager with different applications.
  • Work with the Oracle Identity Manager console and connectors, while creating your own custom one.
  • Troubleshooting issues with OID, OAM, and OID.
  • Dive deep into file system and network security concepts.
  • First time chapter that include most of the critical database threats in real life.

 

You can buy the book now from amazon here

 

Cheers

Osama

Cloud Computing Fundamentals Courses

Cloud Fundamentals is designed to introduce the core cloud concepts to IT Support learners. This course provides an historical perspective of how IT has evolved to the point where it is now using cloud solutions. The course examines the different types of cloud solutions that are available, as well as the basics of cloud services, cloud usage models, and cloud security. The course concludes with an introduction to Microsoft Azure, Amazon AWS and Oracle Cloud.

What you’ll learn

  • Examine core cloud concepts
  • Review basic cloud services
  • Analyze cloud usage models
  • Examine cloud security basics
  • Learn about Microsoft Azure as an IaaS and PaaS solution
  • Learn about Amazon AWS as an IaaS and PaaS solution
  • Learn about Oracle Cloud as an IaaS and PaaS solution

Course date

will start from 1st Sept 2019 – 15 Hours – 5 days 

Course time

UK TIME :- 4:00 PM

Jordan Time : 6:00 PM 

The course time can be change depends on agreement between the instructor and the students 

Course fees 

300$

Continue reading “Cloud Computing Fundamentals Courses”