Showing posts with label Amazon. Show all posts
Showing posts with label Amazon. Show all posts

Tuesday, 1 August 2017

Amazon Web Services Tutorial - Terminology

Amazon Web Services Tutorial - Basic understanding

Question: What is Amazon Web Services(AWS)?
AWS is Amazon's cloud web hosting platform that offers flexible, reliable, scalable, easy-to-use, and cost-effective solutions.

Question: What is cloud computing?
Cloud computing is an computing service in which large groups of remote servers are setup to allow centralized data storage, and online access to computer services or resources.

Question: What are the the benefits of Cloud Computing?
  1. AWS cost efficient
  2. Instantly setup of unlimited server
  3. Highly reliable
  4. Unlimited Storage
  5. Backup & Recovery
  6. Easy Access to Information

Question: What are the types of Cloud Computing?
  1. Public Cloud: Cloud computing services are managed by third party.
  2. Private Cloud: Cloud computing services are managed by own organization.
  3. Hybrid Cloud: Its combination of public cloud and private cloud.

Question: What are the Cloud Service Models of Cloud Computing?
  1. IaaS (Infrastructure as a Service): It provides users with provision of processing, storage, and network connectivity as per requirement.
  2. PaaS (Platform as a Service): The service provider provides various services like databases, queues, workflow engines, e-mails, etc. to their customers.
  3. SaaS (Software as a Service): Third-party providers provide end-user applications to their customers with some administrative capability at the application level.

Question: What is AWS EC2?
Full form of EC2 is Elastic Compute Cloud.
EC2 allow use virtual machines of different configurations as per their requirement.

Question: What is Load Balancing?
Load balancing means to balance the load on web server through adding resources on system. Load balancer manage the load on the server so that it work efficiently.

Question: What is Elastic Load Balancing?
Elastic Load Balancing is dynamically growing and shrinking the load-balancing capacity depending on server.

Question: What is Elastic Load Balancer?
It spread the traffic to web servers, which improves performance.
It is used to distributed the traffic to EC2 instances over multiple available zones, and dynamic addition and removal of Amazon EC2 hosts from the load-balancing rotation.

Question: What is Elastic Caches?
Amazon Elastic Cache is a web service that manages the memory cache in the cloud.

Question: What is Amazon RDS?
Relational Database Service (RDS) provides access of database like MySQL, Oracle, or Microsoft SQL Server database engine.

Question: What is AWS Management Console?
AWS Management Console is a web application for managing Amazon Web Services. It provide you detail about all servers and its resources, user billing/payment etc.

Question: What is Auto Scaling?
Auto Scaling is enabled by Amazon CloudWatch.
AWS CloudWatch can be used to measure CPU utilization, network traffic, etc.
When traffic increase then resource added automatically.

Question: What is Amazon Virtual Private Cloud?
Amazon VPC allows the users to use AWS resources in a virtual network.

Question: What services we can use with Amazon Virtual Private Cloud?
  1. Amazon EC2
  2. Amazon Route 53
  3. Amazon WorkSpaces
  4. Auto Scaling
  5. Elastic Load Balancing
  6. AWS Data Pipeline
  7. Elastic Beanstalk
  8. Amazon Elastic Cache
  9. Amazon EMR
  10. Amazon OpsWorks
  11. Amazon RDS
  12. Amazon Redshift

Question: What is Amazon Route 53?
It is a highly available and scalable DNS web service.
corporates to route the end users to Internet applications by translating human readable names like, into the numeric IP addresses like

Question: What is CloudFront?
CloudFront is a CDN retrieves data from Amazon S3 bucket and distributes it to multiple datacenter locations though edge locations.

Question: What is Amazon DynamoDB?
It is NoSQL database that allows to create database tables, store data in table and retrieve any amount of data.
It automatically manages the data traffic of tables over multiple servers and maintains performance.

Question: What is Amazon Redshift?
It is data warehouse service in the cloud. Its datasets range from 100s of gigabytes to a petabyte.

Question: What is Amazon Kinesis?
Amazon Kinesis is a managed, scalable, cloud-based service that allows real-time processing of streaming large amount of data per second.

Question: What is Amazon Elastic MapReduce?
Amazon Elastic MapReduce is a web service that provides a managed framework to run data processing frameworks such as Apache Hadoop, Apache Spark, and Presto in an easy, cost-effective, and secure manner.

Question: What is Amazon Pipeline?
AWS Data Pipeline is a web service, designed to make it easier for users to integrate data spread across multiple AWS services and analyze it from a single location.

Monday, 31 July 2017

Server Architecture Interview Questions and Answer

Server Architecture Interview Questions and Answer

Question: What is VPC?
Full form of VPC is Virtual Private Cloud.
It is virtual network dedicated to AWS account.It is logically isolated to the other virtual network in the AWS cloud.

Question: Can a VPC of any size be created?
Yes, After selecting an option, you can modify the size and IP address range of the VPC and its subnets.
You can modify the VPC to add more subnets or add/remove gateways at any time after the VPC has been created.
Question: How do AWS VPC work?
It is logically isolated from other virtual networks. You can launch your AWS resources, such as Amazon EC2 instances, into your VPC.
You can configure your VPC and select its IP address range, create subnets, and configure route tables, network gateways, and security settings.

Question: What is route table in AWS?
A route table contains a set of rules, that are used to determine where network traffic is directed.
Each subnet in your VPC must be associated with a route table, the route table controls the routing for the subnet.

Question: What is an Internet gateway AWS?
An Internet gateway is a horizontally scaled, redundant, and highly available VPC component that allows communication between instances in your VPC and the Internet.

Question: What is an Amazon VPC?
Amazon VPC lets you provision a logically isolated section of the Amazon Web Services (AWS) cloud where you can launch AWS resources in a virtual network that you define.

Following are components of VPC
  1. A Virtual Private Cloud
  2. Subnet
  3. Internet Gateway
  4. NAT Gateway
  5. Hardware VPN Connection
  6. Virtual Private Gateway
  7. Customer Gateway
  8. Router

Question: What is an Elastic IP address?
An Elastic IP address is a static IPv4 address designed for dynamic cloud computing. With an Elastic IP address, you can mask the failure of an instance or software by rapidly remapping the address to another instance in your account.
Question: What is AWS VPN?
You can connect your VPC to remote networks by using a VPN connection.

Question: What is Route 53?
Amazon Route 53 (Route 53) is a scalable and highly available Domain Name System (DNS).

Question: What is a static route?
Static routing is a form of routing that occurs when a router uses a manually-configured routing entry, rather than information from a dynamic routing traffic.

Question: What do you mean by dynamic routing?
Dynamic routing is a networking technique that provides optimal data routing. dynamic routing enables routers to select paths according to real-time logical network layout changes.

Question: What is meant by API gateway?
The API Gateway will often handle a request by invoking multiple microservices and aggregating the results.
It can translate between web HTTP and WebSocket and web?unfriendly protocols that are used internally.

Question: What is an API management?
It is process of publishing, documenting and overseeing application programming interfaces (APIs) in a secure, scalable environment.

Question: What is Amazon MWS?
Full form of MWS is Amazon Marketplace Web Service. It is an integrated web service API that helps Amazon sellers to programmatically exchange data on listings, orders, payments, reports, and more. Data integration with Amazon enables high levels of selling automation, which can help sellers grow their business.

Question: What is cloud computing?
cloud computing is the delivery of computing services—servers, storage, databases, networking, software, analytics and more—over the Internet.

Question: what is load balancer?
A load balancer is a device that acts as a reverse proxy and distributes network or application traffic across a number of. servers.
Load balancers are used to increase capacity (concurrent users) and reliability of applications.

Question: What is load balancing on a router?
Network load balancing is the ability to balance traffic across two WAN links without using complex routing protocols like BGP.

Question: How do load balancing servers work?
A load balancer acts as the "traffic cop" sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked.

Question: What is Lambda?
AWS Lambda lets you run code without managing servers, AWS states on the Lambda product page.
You can think of Lambda as an event-driven computing platform;
Lambda runs when triggered by an event and executes code that's been loaded into the system.

Friday, 13 May 2016

How to download image from URL with PHP?

How to download image from url with PHP?

Question: How to download image from url and save in server?
//Image path which we will download

//get extension of image
$ext = pathinfo($imageURL, PATHINFO_EXTENSION);

//Local path of image - where will we save the image
$downloadTo = fopen('import/image/file'.  rand(1, 9999).'.'.$ext, 'wb');

//Download and save image
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $imageURL);
curl_setopt($ch, CURLOPT_FILE, $downloadTo);
curl_setopt($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch);

Question: How to get image extension from url?
$ext = pathinfo($imageURL, PATHINFO_EXTENSION); //.jpg

Question: Download image from URL and display in browser?
    //Image path which we will download

    //get extension of image
    $ext = pathinfo($imageURL, PATHINFO_EXTENSION);

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $imageURL);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    $output = curl_exec($ch);
    switch( $ext ) {
        case "gif": $ctype="image/gif"; break;
        case "png": $ctype="image/png"; break;
        case "jpeg":
        case "jpg": $ctype="image/jpeg"; break;
    header('Content-type: ' . $ctype);

Question: How to check if image is valid OR Not?
 list($width, $height, $type, $attr) = getimagesize($imageURL);
 if (!empty($width) && !empty($height)) {
    echo "Valid Image";
    echo "In Valid Image";

Wednesday, 29 April 2015

How to upload Image in Amazon s3 with android SDK 2.0

How to upload Image Aman s3 in android SDK 2.0

Try below code
images3 = new File(uri.getPath())
ObjectMetadata metadata = new ObjectMetadata();
imageSize = inputStream.available();
TransferManager transferManager = new TransferManager(credentialsProvider);
Upload upload = transferManager.upload(bucket_name, key, images3, metadata);


Friday, 10 October 2014

Download Videos from Amazon S3 - PHP

Download Videos from Amazon S3 - PHP

            $newFileName = "download_filename.mp4";
            header('Content-Type: video/mp4');
            header('Content-Disposition: attachment; filename="' . $newFileName . '"');
            $my_aws_key = 'AWS_KEY';
            $my_aws_secret_key = 'AWS_SCRET_KEY';
            $s3 = new Zend_Service_Amazon_S3($my_aws_key, $my_aws_secret_key);
            $newFileName = "S3_download_filename.mp4";
            $response = $s3->getObjectStream("$newFileName");//download stream from s3

Wednesday, 14 May 2014

PHP Upload File In Amazon S3 Bucket - Code Snippets

PHP Upload File In Amazon S3 Bucket - Code Snippets

Get List of buckets in Amazon S3 bucket and upload a file in Amazon S3 bucket with Zend Framework.

Uploading files in zend framework is very simple because zend framework provides the API which is very simple to use.

Please use following code to upload photos in zend framework.
$my_aws_key = 'AWS_KEY';
$my_aws_secret_key = 'AWS_SECRET_KEY';
$s3 = new Zend_Service_Amazon_S3($my_aws_key, $my_aws_secret_key);

/** Get List of buckets * */
$list = $s3->getBuckets();
foreach ($list as $bucket) {
    echo "Bucket: $bucket\n";
/** Get List of buckets * */

/** get Bucket Files **/
$files = $s3->getObjectsByBucket("BUCKET_NAME");
foreach ($files as $file) {
    echo "File: $file\n";
/** get Bucket Files **/

$imageName = '';
try {
    $s3->putFile($imageName, "BUCKET_NAME/ZFCE-logo-XS.jpg", array(
        Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ,
        'x-amz-storage-class' => 'REDUCED_REDUNDANCY'
die('uploaded successfully');
} catch (Exception $e) {

Monday, 16 September 2013

Amazon S3 Introduction - Basics

Amazon S3 Introduction - Basics

Important Terms

S3: Simple Storage Services
AWS: Amazon Web Services
SDK: Software Development Kit
IAM: Identity Access Management

What is AmazonS3

It is Simple Stored Service provided by Amazon where you can manage files and can put authorized on these files.
Amazon will charge only when you upload/download the files. These files can be easily managed through SOAP, HTTP OR with use of third party Services.

Benefits of S3

  1. Available through API REST/SOAP.
  2. Durability
  3. Economic
  4. Fast
  5. Scalable
  6. Web store not FileSystem

Amazon S3 Concepts 

Bucket: A Bucket is Amazon terminology for what amounts to a folder or directory of files. Bucket names have to be unique across the service. Its in the root and you can create many bucket as you want. You can places data or directory inside the bucket. You can create 100-150 bucket per account. For each bucket, you can control access to the bucket (who can create, delete, and list objects in the bucket), view access logs for the bucket and its objects, and choose the geographical region where Amazon S3 will store the bucket and its contents.

Bucket Naming Convention

  1. Can’t have slahes
  2. It can have lowercase character, number, period(.) and hypen(-)
  3. Should be between 3-255 characters
  4. Must be start with number or letter
  5. Should not have underscore(_)
  6. Must not be inform of IP (
  7. Must not end with –
  8. Should not be .- or -. together

Object: When you upload file or folder in the bucket that is known as object. You can also set the permission on that ozbject. To upload folder you must enable “Enable Enhanced Uploader” of java applet. Objects consist of object data and metadata. The data portion is opaque to Amazon S3

Key: It is unique identifier for an object within the bucket. Every object in a bucket has exactly one key. Because the combination of bucket, key and version Id form uniquely object.
 For example, in the URL, 
here "doc" is the name of the bucket and "2006-03-01/AmazonS3.wsdl" is the key

Region: You can choose the geographical Region where Amazon S3 will store the buckets you create. You might choose a Region to optimize latency, minimize costs, or address regulatory requirements.

Features of S3

Reduced Redundancy Storage (RSS): RRS enables customers to reduce their costs by storing non-critical, reproducible data at lower levels of redundancy than Amazon S3's standard storage.

Bucket Policies: Create bucket with permission. An account can grant one application limited read and write access, but allow another to create and delete buckets as well. An account could allow several field offices to store their daily reports in a single bucket, allowing each office to write only to a certain set of names (e.g. "Nevada/*" or "Utah/*") and only from the office's IP address range. 

AWS Identity and Access Management :
Create users and groups under your organization's AWS account
Easily share your AWS account resources between the users in the account
Assign unique security credentials to each user
Granularly control users access to services and resources
Get a single AWS bill for all users under the AWS account

Access Control Lists


Create Bucket
Write object in bucket
Read bucket
Delete Object
Listing keys

Amazon S3 API

REST Interface: In REST, you use standard HTTP requests to create, fetch, and delete buckets and objects.

SOAP Interface: The most common way to use SOAP is to download the WSDL (go to, use a SOAP toolkit such as Apache Axis or Microsoft .NET to create bindings, and then write code that uses the bindings to call Amazon S3

Paying For Amazon S3
You need not to pay in starting and need to choose any plan. Just use as you need and they will charge @ the end of the month.