AWS Interview Questions and Answer Part – 20

Which of the following options describes Infrastructure in Code?

  • Script containing all needed steps to transform current state into target state.
  • Checklist containing all steps needed to transform current state into target state manually.
  • Blueprint containing target state. Tool transforming current sate into target state. (Ans)

CloudFormation allows you to __ a stack.

  • create, update, and delete (Ans)
  • create and update
  • create

A minimal CloudFormation template contains:

  • Format Version, Description, Resources (Ans)
  • Resources, Inputs, Outputs
  • Resources

A resource definition consists of:

  • Identifier, Type, Properties (Ans)
  • Ordinal Number, Identifier, Properties
  • Type, Properties

The following resources describe…

“Resources”: {
“EC2Instance”: {
“Type”: “AWS::EC2::Instance”,
“Properties”: {
“ImageId”: “ami-bff32ccc”,
“InstanceType”: “t2.nano”
}
}
}

  • a S3 Bucket.
  • an EC2 Instance. (Ans)
  • a RDS Database Instance.
  • an AMI.

Which value is valid for the following parameter?

“Parameters”: {
“VPC”: {
“Description”: “The default VPC”,
“Type”: “AWS::EC2::VPC::Id”
}
}

  • vpc-ssh-bastion-host (Ans)
  • vpc-6b53320e
  • subnet-e16fa6ca

Which of the following options adds the private IP address of the EC2 instance to the outputs?

{
“Resources”: {
“EC2Instance”: {
“Type”: “AWS::EC2::Instance”
},
},
“Outputs”: {
“PrivateIp”: {
“Value”: {“Fn::GetAtt”: [“EC2Instance”, “PrivateIp”]}
}
}
}

  • {“Ref”: “EC2Instance”}
  • {“Ref”: [“EC2Instance”, “PrivateIp”]}
  • {“Fn::GetAtt”: [“EC2Instance”, “PrivateIp”]} (Ans)

A CloudFormation template includes the following mappings section.

“Mappings”: {
“RegionAMI”: {
“us-east-1”: {“AmazonLinux”: “ami-8fcee4e5”, “Ubuntu”: “ami-fce3c696”},
“eu-west-1”: {“AmazonLinux”: “ami-e1398992”, “Ubuntu”: “ami-f95ef58a”},
“ap-northeast-1”: {“AmazonLinux”: “ami-59bdb937”, “Ubuntu”: “ami-a21529cc”}
}
}

What’s the output of the following function?

{“Fn::FindInMap”: [“RegionAMI”, “eu-west-1”, “AmazonLinux”]}

  • ami-e1398992 (Ans)
  • ami-f95ef58a
  • Nothing, the parameters are invalid.
  • ami-59bdb937

A stack named webapp was created in region eu-west-1. What’s the output of the following function?

{“Fn::Select”: [“0”, {“Fn::GetAZs”: {“Ref”: “AWS::Region”}}

  • az-1
  • eu-west-1a (Ans)
  • eu-west-1

CloudFormation parameters allow you to:

  • Add additional properties to resources without changing the template
  • Create multiple stacks based on the same template
  • Specify input for a template when creating or updating a stack (Ans)

What’s wrong with the described EC2 instance?

“EC2Instance”: {
“Type”: “AWS::EC2::Instance”,
“Properties”: {

“UserData”: {“Fn::Join”: [“\n”, [
“#!/bin/bash -ex”,
“yum install -y httpd”,
“cd /var/www/html”,
“echo ‘Hello World!’ > index.html”,
“service httpd start”
]]}
}
}

  • User Data is limited to 128 characters.
  • There is no package called httpd.
  • User Data needs to be encoded in Base64. (Ans)

A CloudFormation template is written in…

  • Bash Script
  • XML
  • JavaScript
  • JSON (Ans)

Which of the following is true of ECS?

  • ECS automatically launches a fully-managed EC2 instance for every cluster created.
  • At the cluster level, ECS can only be managed from the browser-based console.
  • Besides for the regular AWS resources in use, ECS charges users on a per-cluster basis.
  • ECS offers integration with either the ECS registry or Docker Hub images. (Ans)

You can display detailed information about an ECS cluster from the command line using…

  • aws ecs clusters –list
  • aws ecs list-clusters
  • aws ecs describe-clusters (Ans)
  • aws ecs cluster –help

You can set load balancing and auto scaling for a deployment in the __ configuration menu of the console.

  • Container (Ans)
  • Services
  • Cluster Update
  • Task Definitions

Which of the following commands will return authentication credentials for the EC2 Container Repository service?

  • aws ecr login –region
  • aws get-login –region
  • aws ecr get-login –region (Ans)
  • aws get-region

Adding the “Amazon EC2 Container Service for EC2 Role” to your EC2 instance allows _.

  • the EC2 instance to be registered within an ECS system
  • the account root user to manage the EC2 instance
  • ECS resources to connect to the EC2 instance
  • the EC2 instance to connect to ECS resources (Ans)

Which of the following files on an EC2 ECS-optimized AMI instance must be edited to permit access to Docker Hub private repositories?

  • /ecs/ecs.config
  • /etc/ecs/ecs-config
  • /etc/ecs-config
  • /etc/ecs/ecs.config (Ans)

What is the primary purpose of adding a tag to a Docker image?

  • To allow for easier visual identification once your infrastructure grows
  • To direct Docker to the appropriate remote repository (Ans)
  • To identify the object as an image
  • To identify the image’s ownership and origin

For security, the Docker website uses encryption certificates to _.

  • ensure that all images uploaded to Docker Hub are free of malware
  • secure the computers of local Docker clients
  • ensure that all “docker run” operations are valid
  • secure connections between the website and clients (Ans)

What is the role of apache2ctl in this command?
docker run -d -p 80:80 webserver /usr/sbin/apache2ctl -D FOREGROUND

  • apache2ctl will check to make sure the Apache webserve software package is properly installed on a container.
  • apache2ctl is the name of a Docker image.
  • apache2tcl will run the Apache webserver software package when the container boots. (Ans)
  • apache2ctl will launch a new Docker container as a backend server to your main container.
Rajesh Kumar
Follow me