Scenarios and Important Concepts Flashcards
Review Test/Quiz questions and concepts that I got wrong as well as concepts/questions that are said to be on the exam
You configured an HTTPS subscription for an SNS topic, but for some reason your HTTPS endpoint is not receiving any messages. How can you troubleshoot the problem?
Configure delivery status logging and analyze delivery failures in CloudWatch Logs.
You are publishing messages to an SNS topic and are expecting to have subscribers using different delivery protocols. How can you make sure that your messages will be readable by each platform?
Write your messages in a JSON format. You will then need to add a specific version of the message only for the platforms that differ from the default.
You are working on a new project involving the creation of Lambda functions for a Serverless Web Application. A large team of developers will work on this project performing multiple changes to the Lambda function code. As the best practice, you have been asked to publish a version while creating a Lambda function or updating a function code. Which of the following is
TRUE with regards to the published version of a Lambda Function?
- A published version is a snapshot of function code and has the same version number when a previous version is deleted & recreated.
- A published version is a snapshot of function code and has a unique Amazon Resource Name that can be updated using “UpdateFunctionCode.”
- A published version is a snapshot of function code and configuration that can be updated using the “Publish” parameter.
- A published version is a snapshot of function code and configuration thatcan’t be changed.
- A published version is a snapshot of function code and configuration thatcan’t be changed.
A Publish version is a snapshot copy of a Lambda Function code & configuration in $LATEST version. No configuration changes can be done to a published version & it has a unique ARN
which can’t be modified.
An organization is using AWS Elastic Beanstalk for a web application. The Developer needs to configure the Elastic Beanstalk environment with deployment methods to create new instances and deploy code to those instances.
What are the 2 deployment methods that will deploy code ONLY to new instances?
- Immutable deployments
- Blue/Green deployment
Both allow you to have seperate deployments.
All at Once is not an option in the scenario because then your enironment is completely out of service.
You are using AWS SAM templates to deploy a serverless application. Which resource will embed nested applications from Amazon S3 buckets?
AWS : : Serverless : : Application
This is the template used to embed applications from S3 buckets/
Seperate templates exist for Lambda Layered functions and for creating lambda functions.
For SAM application, what does the AWS::Serverless::LayerFunction resource type create?
Lambda layered functions
For SAM application, what does the AWS::Serverless::Function resource describe?
describes the configuration for creating a Lambda function
You have created 3-stages in your codePipline:
Source -> Build -> Staging
Your build failes during hte ‘Build’ phase. What happens?
The entire process will halt
Your team has completed development of an application. Now, this needs to be deployed to an application on an EC2 Instance. The Application data will be stored on a separate volume which
needs to be encrypted at rest. How can you ensure this requirement is met?
Make sure that the EBS volume is encrypted at its creation time.
In API Gateway, how can you pass a stage variable to an HTTP URL? (There are 2)
- http://example.com/${stageVariables.variable}/prod
- http://${stageVariables.variable}.example.com/dev/operation
When can a stage variable be used as part of the HTTP integration URL?
- A full URI without protocol
- A full domain
- A subdomain
- A path
- A query string
A developer is building an application that needs access to an S3 bucket. An IAM role is created with the requireed permissions to access the S3 bucket. Which API call should hte developer use in the application so that the code can access the S3 Bucket?
STS:AssumeRole
A developer has recently deployed as AWS lambda function that computes a Fibonacci sequence using recursive Lambda invocations. A pre-defined AWS IAM policy is being used for this function, and only the requried dependencies are packaged. A few days after deployment, the Lambda function is being throttled. What should the Developer have done to prevent this, accoring to best practice?
Avoid the use of recursive code.
Using recursive code in a lambda function can lead to unintended volume of function invocations and escalated costs.
If you accidentally build a Lambda code that contains a recursive fuction, what action(s) should you take immediately while you update the code?
Set the function concurrent execution limit to ‘0’ (zero) immediately to throttle all invocations of the functions while you update the code.
A company is writing a Lambda function that will run in multiple stages (dev, test, prod). The function is dependent on several external services, and it must call different endpoints for these services based on the functions deployment stage. What lambda feature will enable the developer to ensure that the code references the correct endpoints when running in each stage?
Environment Variables
You can create different environment variables in the Lambda’s function that can be used to point to the different services.
An application is publishig a custom CloudWatch metric any time an HTTP 504 error appears in the application logs. There errors are being recieved intermittenly. There is a CloudWatch alarm for this metric and the developer would like the alarm to trigger ONLY if it breaches two evaluation periods or more. What should be done to meet this requirement?
The evaluation period and Data Points to Alarm should be set to 2 when creating this alarm.
When you create an alarm, you specify 3 settings to enable CloudWatch to evaluate when to change the alarm state:
Period, Evaluation Period, and Datapoints to Alarm
A company is currently using API Gateway services for development. You need to control the behavior of an API’s front-end interactions. What are the 2 main things you can do to acheive this?
As a developer you control the behaviors fo your API’s frontend interactions by configuring the method request and response.
A company is currently using API Gateway services for development. You need to control the behavior of an API’s back-end interactions. What are the 2 main things you can do to acheive this?
As a developer, you can control the behaviors of you API’s backend interactions by setting up the integration reponse and integration request.
You are using AWS Envelope Encryption to encrypt all of your sensitive data. How is unencrypted data encrypted using this service?
Data is encrypted using a plaintext Data key. This Data key is further encrypted using a plaintext Master Key.
This plaintext Master Key is securely stored in AWS KMS and is refered to a Customer Master Key.
You’ve been given a requirement to customize the content which is distributed to users via CloudFront Distribution. The content origin is an S3 bucket. How could you achieve this?
Consider using Lambda@Edge - this lets you execute functions that customize the content that cloudFront delievers.
NOTE: You could add an event to the S3 bucket and make that event invoke a Lambda function that would customize content, but this would not be the simpliest solution.
You are developing an appliction that has a key requirement from an architecture point of view to decouple the entire system to ensure less dependency. What is the most suitabe service to help achieve this?
AWS Simple Queue Service
Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications.
What is AWS Opswork?
A configuration management service that provides managed instances of Chef and Puppet. Chef and Puppet are automation platforms that allow you to use code to automate the configurations of your servers. OpsWorks lets you use Chef and Puppet to automate how servers are configured, deployed, and managed across your Amazon EC2 instances or on-premises compute environments.
An application has been making use of DynamoDB for its backend datastore. The size of the tables has grown to 20GB, and the scans on the table are causing throttling errors. What can you implement to avoid these errors?
Reduce the page size
The scan operation provides a limit paramter that you can use to set the page size for your request. Each query or scan request with a smaller page size uses fewer RCUs and creates a ‘pause’ between each request.
Your company has developed a web application and is hosting it in an Amazon S3 bucket configured for statis web hosting. The users can log in to this app using their Google / Facebook login accounts. The application uses the AWS SDK for JavaScript in the browser to access data stored in a Amazon DynamoDB table. How can you ensure that API keys for access to your data in DynamoDB are kept secure?
Configure a web identity federation role within IAM to enable access to the correct DynamoDB resources and retrieve temporary credentials.
What is web identity federation?
Using a well known identity provider (IdP) to recieve an authentication token, and then exchange that token for temporary security credential in AWS that map to an IAM role with permissions to use the resources in your AWS account.
Why does using a Well-Known Idenity Provider help keep your account secure?
Because you do not have to embed and distribute long-term security credentials within your application.
You are planning to deploy a built application onto an EC2 Instance. There will be several tests conducted on this instance. You want to have the ability to capture the logs from the web server to help diagnose any issues if they occur. How can you achieve this?
Install CloudWatch agent on the Instance and configure it to send the webs server logs to a central location in cloudWatch.
You’ve developed a set of scripts using AWS lambda. These scripts need to access EC2 Instances in a VPC.What needs to be done to ensure that the AWS lambda function can access the resources in the VPC?
AWS lambda runs your functions code securely within a VPC by default. However, to enable your Lambda function to access resources inside your private VPC, you must provide additional VPC-specific cofiguration information that includes VPC subnet ID’s and Security Group ID’s.
You’ve currently been tasked to migrate an existing on-premises environment to Elastic Beanstalk. The application does not make use of Docker containers. You also can not see any relevant environments in the beanstalk service that woud be suitable to host your application. What should you consider doing in this case?
Consider using Packer to create a custom platform.
You are using AWS SAM to define a Lambda function and configure CodeDeploy to manage deployment patterns. You would like to gradually shift customers over to the newly deployed version. What are the three deployment preference types that could be used to achieve this?
- Canary - Traffic is shifted in 2 increments.
- Linear - Traffic is shifted in equal increments with an equal number of minuted between each increment.
- All-at-Once - All traffic is shifted from the original lambda function to the updated Lambda function version at once.
What is the formula to calculate DynamoDB RCU’s for eventually consistent reads?
(# of items/second * # of actions needed) / 2
Where # of actions needed is based on 4Kb of data for each read.
What is the formula to calculate # of WCU’s for DynamoDB
(# of items/second * # of actions needed)
Wherer # of actions needed is based on 1Kb of data for each write.
What is the formula to calculate DynamoDB RCU’s for strongly consistent reads?
(# of items/second * # of actions needed) / 1
Where # of actions needed is based on 4Kb of data for each read.
When should you choose to use AWS Opsworks over CloudFormation?
You should use OpsWorks in place of CloudFormation if you need to deploy an application that requires updates to its EC2 instances. If your application uses a lot of AWS resources and services, including EC2, use a combination of CloudFormation and OpsWorks.
When should you choose ElasticBean stalk over CloudFormation?
Elastic Beanstalk deploys the required web servers and configures auto-scaling, monitoring, logging and alerting for you. If your application fits entirely inside Elastic Beanstalk, then you may not need additional tools.
Most likely, however, your application will need other AWS resources, such as database or storage service. In this scenario, use CloudFormation to deploy Elastic Beanstalk along with the other resources.
My deployments on Elastic Beanstalk have been painfully slow, and after looking at the logs, I realize this is due to the fact that my dependencies are resolved on each EC2 machine at deployment time. How can I speed up my deployment with the minimal impact?
Resolve dependencies beforehand, package them in a zipfile, and upload them to ElasticBeanstalk.
What service does Elastic Beanstalk use under the hood?
CloudFormation
You would like your Elastic Beanstalk environment to expose an HTTPS endpoint instead of an HTTP endpoint in order to get in-flight encryption between your clients and your web servers. What must be done to setup HTTPS on Beanstalk?
create a .ebextensions/elb.config file to configure the Load Balancer
You are looking to perform a set of repetitive and scheduled tasks asynchronously. Which Elastic Beanstalk environment should you setup?
Setup a worker environment and a cron.yaml file
How do you give cross account access to your Code Commit repository?
Use an IAM Role in your AWS account and use AWS STS with the AssumeRole API
Describe CodeCommit/GIT Authentication
- SSH Keys - can be configured in a users IAM Console
- HTTPS - done throught CLI Authtentication helper
- MFA - can be enabled for extra security
Describe CodeCommit/Git Authorization
IAM policies manage user / roles rights to repos
How is code commit encrypted?
At reset using AWS KMS
In transist with SSH or HTTPS
If you want to recieve notification from CodeCommit about changes related to the code, what AWS services can you use to trigger notifications?
AWS Lambda or AWS SNS
Examples:
- Deletion of branches (someone deleted code)
- pushes that happens in the master branch (someone added to the code)
- Notify external build system
- perform codebase analysis (check to make sure cred aren’t in code)
If you want to recieve notification from CodeCommit about pull requests, what AWS services can you use to trigger notifications?
CloudWatch Event Rules
Examples
- pull request updates
- commit comments (not the commit itself, just the comments on the commit)
- cloudwatch event rules can go into an SNS topic
In CodePipeline, can action groups have multiple stages or can stages have multiple actions groups?
stages can have multiple actions groups
action groups can be sequential or parallel
What must be runing on EACH EC2 machine (or on remise machine) for Code Deploy to work?
CodeDeploy Agent
It continuously polls AWS CodeDeploy for work to do
What is a CodeDeploy target?
EC2 instance with tags or an ASG
Your CodePipeline hasn’t deployed code to Elastic Beanstalk even though you’ve pushed code to your CodeCommit repository. It used to work 10 minutes ago. What reason is the most likely to explain that situation?
a. The IAM permissions are wrog
b. CodePipeline is waiting for manual approval
c. Your CodeBuild stage probably failed some tests
d. Someone has deleted the Elastic Beanstalk environment
c. Your CodeBuild stage probably failed some tests
You would like to improve the performance of your CodeBuild build. You realize that 15 minutes at each build is spent on pulling dependencies from remote repositories and that takes a while. What should you do to drastically speed up the build time?
Change buildspec/yml to enable dependency caching in Amazon S3
You would like to deploy static web files to Amazon S3 automatically, after generating the static websites from markdown files. Which services should you use for this?
CodePipeline and CodeBuild
CodeBuild can run any commands, so you can use it to run commands incuding generating a static website and copy your static webfiles to Amazon S3.
Which hook step should be used in appspec.yml file to ensure the application is properly running after being deployed?
ValidateService
You would like to have a one-stop dashboard for all the CICD needs of one of your projects. You don’t need heavy control of the individual configuration of each components in your CICD, but need to be able to get a holistic view of your projects. Which service do you recommend?
CodeStar
when and why would you use AWS CloudFormation within AWS CodePipeline?
You can select/use CloudFOrmation as a deployment action in any stage of the CodePipeline. AWS recommends using AWS CloudFormation in an AWS CodePipeline project to track infrastructure changes and tests.
What are two deployment methods supported by AWS CI/CD process?
AWS CodeDeploy
AWS Elastic Beanstalk
Which is the only resource-based policy that the IAM service supports?
Trust Policy
In addition to regular sign-in credentials, AWS supports Multi-Factor Authentication (MFA) for accounts with privileged access.
Which of the following MFA mechanisms is NOT for root user authentication?
- Hardware MF device
- U2F security key
- Virtual MFA device
- SMS text-message based MFA
SMS text message based device
In SQS can you change the queue type once a queue has been created.
No.
You can’t change the queue type after you create it and you can’t convert an existing standard queue into a FIFO queue. You must either create a new FIFO queue for your application or delete your existing standard queue and recreate it as a FIFO queue.
The development team at a company creates serverless solutions using AWS Lambda. Functions are invoked by clients via AWS API Gateway which anyone can access. The team lead would like to control access using a 3rd party authorization mechanism.
As a Developer Associate, what would you recommend for the given use-case?
“Lambda Authorizer”
An Amazon API Gateway Lambda authorizer (formerly known as a custom authorizer) is a Lambda function that you provide to control access to your API. A Lambda authorizer uses bearer token authentication strategies, such as OAuth or SAML. Before creating an API Gateway Lambda authorizer, you must first create the AWS Lambda function that implements the logic to authorize and, if necessary, to authenticate the caller.
How does KMS encryption work?
KMS stores the CMK, and receives data from the clients, which it encrypts and sends back
Can exported output values from CloudFormation be duplicated within a single region?
No.
Exported Output Values in CloudFormation must have unique names within a single Region.