Showing posts with label AWS. Show all posts
Showing posts with label AWS. Show all posts

Sunday 31 May 2020

AWS Elastic Beanstalk Interview Questions and Answers

AWS Elastic Beanstalk Interview Questions and Answers

Question: What is Elastic Beanstalk in AWS?
AWS Elastic Beanstalk is End-to-end web application management.

Question: Can we use Elastic beanstalk to deploy the web application which is made in Node OR PHP?
Yes, AWS Elastic Beanstalk is service for deploying and scaling web applications and services developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker on familiar servers such as Apache, Nginx, Passenger, and IIS.

Question: How does works Elastic Beanstalk?
You simply upload your code and Elastic Beanstalk automatically handles the deployment, from capacity provisioning, load balancing, and automatic scaling to web application health monitoring, with ongoing fully managed patch and security updates.

What are Benefits and features of Elastic Beanstalk?
  1. Easy to get started
    Elastic Beanstalk is the simplest way to deploy and run your web application on AWS.
  2. Complete resource control
    You have the freedom to select the AWS resources, such as Amazon EC2 instance types, that are optimal for your web application.
  3. Fully managed: update your web application with the latest platform security and patch updates.
  4. Automatic application health monitoring
    Elastic Beanstalk automatically collects more than 40 key metrics and attributes to determine the health of your web application

Question: What Language Supported by Elastic Beanstalk
  1. Go
  2. Java SE
  3. Java with Tomcat
  4. NET on Windows Server with IIS
  5. Node.js
  6. PHP
  7. Python
  8. Ruby
  9. Packer Builder

Question: How is AWS CloudFormation different from AWS Elastic Beanstalk?
AWS CloudFormation helps you provision and describe all of the infrastructure resources that are present in your cloud environment. On the other hand, AWS Elastic Beanstalk provides an environment that makes it easy to deploy and run applications in the cloud.
AWS CloudFormation supports the infrastructure needs of various types of applications, like legacy applications and existing enterprise applications. On the other hand, AWS Elastic Beanstalk is combined with the developer tools to help you manage the lifecycle of your applications.

Question: Who should use AWS Elastic Beanstalk?
Those who want to deploy and manage their applications within minutes in the AWS Cloud. You don’t need experience with cloud computing to get started. AWS Elastic Beanstalk supports Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker web applications.

Wednesday 10 July 2019

How to upload very large file in S3 using PHP?

How to upload very large file in S3 using PHP?

Step 1: Install AWS S3 Library (If not installed)

composer require aws/aws-sdk-php

Step 2: Get Access key/Secret Access Key (If you have not)

  1. Open the IAM console (
  2. From the navigation menu, click Users.
  3. Select your IAM user name.
  4. Click User Actions, and then click Manage Access Keys.
  5. Click Create Access Key.
  6. Your keys will look something like this:
    Access key ID example: AKARUNKODNN7EXAMPLE Secret access key example: wJaXUtFDADnFEMI/K7MDDEG/bPxRfiDDDEXAMPLEKEY

Step 3:Upload the files

require 'vendor/autoload.php';

use Aws\Common\Exception\MultipartUploadException;
use Aws\S3\MultipartUploader;
use Aws\S3\S3Client;

//Init S3 Object
try {
    $s3 = new S3Client([
        'version' => 'latest',
        'region'  => 'us-east-1',
        'credentials' => [
            'key'    => $myAwsKey,
            'secret' => $myAwsSecretKey,
} catch (MultipartUploadException $e) {
        echo $e->getMessage() . PHP_EOL;

//Start uploading
    $uploader = new MultipartUploader($s3, $staticFilePath.'/GM-hKStd-1211-28453_720p.mp4', 
        'bucket' => $s3Media,
        'key'    => $s3FileName,
        'ACL'    => 'public-read',
}  catch (Exception $e){

// Perform the upload.
try {
    $result = $uploader->upload();
    //It will give you complete path of S3 URL
    echo "Upload complete: {$result['ObjectURL']}" . PHP_EOL;
} catch (MultipartUploadException $e) {
    echo $e->getMessage() . PHP_EOL;

Tuesday 19 March 2019

AWS Rekognition for beginners

aws rekognition for beginners

Question: What is Amazon Rekognition?
Amazon Rekognition makes it easy to add image/video analysis to your applications.

Question: What different data we can get from Rekognition?
--Detect Objects and scenes that appear in photo/video.
--Face-based user verification.
--Detect Sentiment such as happy, sad, or surprise
--Unsafe Content Detection
--Celebrity recognition
--Text detection
--Rekognition can work on millions of photo.

Question: Give simplest example of working of Rekognition.
Each time a person arrives at your home, your door camera can upload a photo of the visitor to Amazon S3,
triggering a Lambda function that uses Rekognition API operations to identify your guest, and display the data on screen/mobile.

Question: Give some use case for Rekognition?
--Searchable image and video libraries
--Face-based user verification App
--Get the Sentiment and demographic analysis
--Detect the Unsafe Content Detection from photo/video
--Detect the Celebrity recognition
--Get the Text detection From photo/video

Question: What we can get from Rekognition for photos?
--Label detection
--Face detection and comparison
--Celebrity recognition
--Image moderation
--Text in image detection

Question: What we can get from Rekognition for videos?
--Suggestive and explicit adult content

Question: Recommendations for Stored and Streaming video?

Question: Give useful links for rekognition?

Get understanding

Run sample code online (Require login)

API Docs

Question: What are different type of commands detection for videos.
Labels - StartLabelDetection - GetLabelDetection
People - StartPersonTracking - GetPersonTracking
Faces - StartFaceDetection - GetFaceDetection
Celebrities - StartCelebrityRecognition - GetCelebrityRecognition
Detect adult content - StartContentModeration-GetContentModeration

Question: What are different limitation by video Rekognition?
Video must be available in S3
Video must be H.264 codec.
File format must be MPEG-4 and MOV
Max filesize is 8GB

Monday 20 August 2018

How to Setup Password Authentication For AWS ec2 Instances

How to Setup Password Authentication For AWS ec2 Instances

Set the password for root user

  1. Login to SSH using  .pem file
  2. Change user as root user.
    sudo su
  3. Go to ssh config file
    vi /etc/ssh/sshd_config
  4. Change the following var in ssh config
    PasswordAuthentication yes
    PermitRootLogin yes
  5. Change the Root password
    passwd root

    It will prompt the password, you need to provide the password two time.
  6. ReStart the server
    service sshd restart

Now, you can login to EC2 instance with password .

Note: we have set the password for root user not for ec2-user

Thursday 2 August 2018

AWS interview questions and answers for 2 year experienced

AWS interview questions and answers for 2 year experienced

Question: Difference between dedicated instance and dedicated host?
Dedicated Instances are EC2 instances that run in a VPC on hardware that's dedicated to a single customer and are physically isolated other AWS accounts. When you reboot the dedicated instance, you will get instance in same VPC but not the same instance.

Dedicated instance may share hardware with other instance of same account.

Dedicated Host gives you additional visibility and control over how instances are placed on a physical server, and you can consistently deploy your instances to the same physical server over time. When you reboot the dedicated host, you will get instance same instance in same VPC.

Question: What is a Load Balancer?
A Load Balancer is a device that distributes network or application traffic across a cluster of servers.

Question: What are different type Load Balancer?
  1. Application Load Balancer: An Application Load Balancer makes routing decisions at the application layer (HTTP/HTTPS), supports path-based routing.
  2. Network Load Balancer: A Network Load Balancer makes routing decisions at the transport layer (TCP/SSL). It can handle millions of requests per second. After the load balancer receives a connection, it selects a target from the target group for the default rule using a flow hash routing algorithm.
  3. Classic Load Balancer: A Classic Load Balancer makes routing decisions at either the transport layer (TCP/SSL) or the application layer (HTTP/HTTPS)

Question: From where we can access Elastic Load Balancing?
  1. AWS console
  2. AWS Command Line Interface (AWS CLI)
  3. AWS SDK
  4. Query API

Question:How does Elastic Load Balancing Works?
A load balancer accepts incoming traffic from clients and routes request to EC2 in one or more Availability Zones.

It also monitor the health of Ec2 instance and route only to the healthy instance.
You can configure one or more listener with using port and protocol, listener check for connection request.

Question: What are different type of database in AWS?
  1. RDS
    1. SQL
    2. MySQL
    3. PostgreSQL
    4. Orcle
    5. Aurora
    6. MariaDB
  2. DynamoDB
  3. Redshift

Question: what is Lightsail?
Lightsail is easiest way to launch and manage a virtual private server with AWS.
Lightsail plans include everything you need to jumpstart your project – a virtual machine, SSD-based storage, data transfer, DNS management, and a static IP – for a low, predictable price.

Question: What are Placement Groups?
Placement Groups are logical groupings of instances in the selected AWS region.
Used for launching cluster compute instance types. ( e.g. cc2.8xlarge) Cluster Compute Instances provide a large amount of CPU.

Question: What is Amazon S3 Transfer Acceleration?
Amazon S3 Transfer acceleration enables fast, easy, and secure transfers of files over long distances between your location and an S3 bucket location.
Steps to upload
  1. Enable S3 Transfer Acceleration for bucket
  2. Now you have separate URL for upload, at same page
  3. When you upload the files at nearest location, it will auto sync to bucket and disturibute to other location.

Question: When Amazon S3 Transfer Acceleration is beneficial?
When your location and your bucket location is too far.
For example:
You are mumbai region and bucket is in US east, in such type of case we can use it will upload files faster.

Question:Does Elastic load balancer have public IPV4 Address?
No, load balancer does not have public IPV4 address.

Question: What is Amazon RDS Multi-AZ?
Amazon RDS Multi-AZ deployments provide enhanced availability and durability for Database Instances, making them a workable for production database workloads.

Question: How does Amazon RDS Multi-AZ?
In case of Multi-AZ DB Instance, Amazon RDS automatically creates a primary DB Instance and synchronously replicates the data in a different Availability Zone.
Each instance runs on its own physically distinct, independent infrastructure, and is engineered to be highly reliable.
In case of multi az, there is always single endpoint for db connections.

Question: What is Amazon RDS Read Replicas?
Read Replicas makes it easy to elastically scale out beyond the capacity of a single DB instance for read-heavy database workloads.

Question: What is the difference between the Multi-AZ deployment and Read Replica in AWS RDS?
Multi-AZ offer where you get standby replica of your RDS in a different Availability Zone which will substitute automatically your primary database in case of its maintenance, failure or AZ failure.
You can't access individual instance, only primary database can access.(But in case of failure, you can access individual instance)

In case of RDS Read Replicas, we can access individual instance. In case of failure, you can make other read replica as primary.

Question: What is Amazon DynamoDB?
Amazon DynamoDB is a fully managed NoSQL database service that supports key-value and document data structures as part of the Amazon Web Services.

Use Cases
  1. Serverleas web application
  2. Microservices data store
  3. Mobile backends

Question: What is Instance Store volume?
An instance store is a temporary storage type located on disks that are physically attached to a host machine.

In this type storage, the data is not persistently stored. Once an instance is terminated or stopped, all of its data is lost.
Instance store volumes are ideal for temporary backup, and for storing an application’s cache, logs.

Question: What are different types of Instance Store Volume Types
  1. Ephemeral
  2. Non-Volatile Memory
  3. TRIM

Question: What are difference Instance Store-Backed vs AWS EBS-Backed?
instance store-backed volumes are a good option when you need storage with very low latency.
When we Instance store devices, stop or terminate an instance, every block of storage in the instance store is reset.

Question: What are limitations of Instance Store Volumes?
  1. Support C3, G2, HI1, I2, I3, M3, R3, and X1 instance families
  2. Data in the instance store can be lost if the underlying disk drive fails.
  3. Instance store devices have only root volume, which can’t be extended
  4. It's not possible to resize instance-backed root volumes on the fly
  5. Taking a snapshot or AMI of an instance store volume is not as straightforward as taking snapshot of EBS volume.