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.


Friday, 27 July 2018

Google speech API with Punctuation and word timestamp in PHP

Google speech api with Punctuation and word timestamp

Question: What is Speech Recognition?
Google Cloud Speech-to-Text enables developers to convert audio to text by applying powerful neural network models in an easy to use API. The API recognizes 120 languages and variants.


Question: Does it provide Speech Recognition for real-time streaming?
Yes, Its provide for both real-time streaming or pre-recorded audio.


Question: What are the different languages for it provides speech to text?
https://cloud.google.com/speech-to-text/docs/languages


Question: Does it return immediately?
Cloud Speech-to-Text can stream text results, immediately returning text as it’s recognized from streaming audio or as the user is speaking.
For short audio (less than a min), It return results.

For Longer audio, Its take time (1min -20) depend on audio file length.


Question: What are different Models for Speech to Text?
  1. command_and_search: Best for short queries such as voice commands or voice search.
  2. phone_call: Best for audio that originated from a phone call .
  3. video: Best for audio that originated from video or includes multiple speakers
  4. default: Best for audio that is not one of the specific audio models.

You can set model in following way
$operation = $speech->beginRecognizeOperation(
   'gs://product_id/file_name.wav',
    array('model'=>'video')
); 



Question: What are the pricing for speech to text?
https://cloud.google.com/speech-to-text/pricing



Question: How to set private key in the environment?
putenv('GOOGLE_APPLICATION_CREDENTIALS=priviate_key_json.json'); 



Question: How to get punctuation in results?
punctuation are the character which we use in written. for example comma(,), perios(.), question mark?.
You can get the punctuation in transcription results by providing enableWordTimeOffsets=true in the config.

for example:
You can set enableWordTimeOffsets in following way
$operation = $speech->beginRecognizeOperation(
   'gs://product_id/file_name.wav',
    array('enableWordTimeOffsets'=>true,'model'=>'video')
); 



Question: What is office link for speech to text?
https://cloud.google.com/speech-to-text/


Question: What is Github link for speech to text?
https://github.com/GoogleCloudPlatform/google-cloud-php-speech


Question: How to install the SDK for speech to text?
php composer.phar require google/cloud-speech



Question: How to get the transcription for small audio file.?
$audioFilePath='gs://ar10w12018/1135-19114_720p.wav';//You can place your path here
$speech = new SpeechClient([
    'languageCode' => 'en-US'
]);

// Recognize the speech in an audio file.
$results = $speech->recognize(
   $audioFilePath,
);

foreach ($results as $result) {
    echo $result->topAlternative()['transcript'] . "\n";
}   



Question: How to get the transcription for heavy audio file.?
for heavy files, make sure you have already uploaded to google cloud and you have path.

$audioFilePath='gs://ar10w12018/1135-19114_720p.wav';//You can place your path here
                $speech = new V1p1beta1\SpeechClient([
                    'languageCode' => 'en-US',
                ]);
                $config = new V1p1beta1\RecognitionConfig();
                $config->setLanguageCode('en-US');
                $config->setEnableWordTimeOffsets(true);
                $config->setEnableAutomaticPunctuation(true);
                $config->setModel('video');
                
                $audio = new V1p1beta1\RecognitionAudio();
                $audio->setUri($audioFilePath);
                $operation = $speech->longRunningRecognize($config, $audio);
                
              $result['operation']=$operation->getName();//operation name
 

You can get the results by using Operation Name.
$operationName='194790781308823479';
$speech = new SpeechClient([
    'languageCode' => 'en-US'
]);
$operation = $speech->operation($operationName);

$isComplete = $operation->isComplete();
if($isComplete){
$results=$operation->results();
}