Test Review Questions Flashcards
How to deploy a lambda function with multiple stages - dev, test, prod
Use environment variables to configure different dndpoints for each stagew
On premises application accessing AWS services through SDK
Generate access key and store in secrets manager
Improve on storing session state in memory
Store in Elasticache for distributed session management
Monitor events in cloudwatch every 10 seconds
High resolution cloudwatch metric - can set alarms for periods of 10 or 30 seconds
Cloudwatch metric standard resolution granularity
Granularity of 1 minute, and period of at least 5 minutes
Override the build command on a CodeBuild project to test a change
Run the start build command from the CLI with the ‘buildspecOverride’ property
Migrating SQL to AWS, current encrypting some data with Transparent Data Encruption
Use RDS - supports TDE
Update Beanstalk EC2 instance type
Create a config file in S3 with the new instance type
Large number of reads/writes to S3 per second
Use a hash prefix when writing to distribute I/O load across multiple partitions
Preprocess data before analysis in Kinesis Analytics
Use Lambda to preprocess data
Mintor incoming connections on an ELB
Enable access logs on the load balancer
Reduce throttling from scans on a large DDB table
Reduce page size to reduce RCUs per request
Bootstrap application script into autoscaling instances
Place script into Userdata for the instance
Analyse information stored in Cognito
Cognito streams configures a Kinesis stream to which Cognito can push dataset changes
How to implement a Lambda function with 300 second execution time
Default timeout is 3 seconds - increase this
Where to place a healthcheck.config file for an ~Elastic Beanstalk application
In the .ebextensions folder of the application’s source code
Allow users to test an API gateway instance.
Ensure that a deployment is create in API gateway
How to allow an application to take 60 to process a message from an SQS queue
Increase the visibility timeout in the queue from the default of 30 seconds, then delete the message after processing
Test out permissions assigned to a policy via CLI
Get the context keys then use them with command ‘aws iam simulate custom policy’
Steps to host a static website
Enable website hosting, configure index document, set permissions for website access
MFA for S3 bucket
Add bucket policy with condition ‘aws:MultiFactorAuthPresent’:’false’ as a deny policy
Reduce response time for reads on DDB to microseconds
Use DAX - DDB in-memory caching
Preconfigure EC2 instances with NGINX web server using cfn
Use cfn-init helper script - allows you to describe configurations rather than scripting steps.
Migrate from a Subversion repo to CodeCommit
For svn, perforce or TFS, migrate to git first, then to CodeCommit
Enable encryption at rest on existing DDB table
Not possible - create a new table with encryption enabled and copy data across (most likely an obsolete question - current sources show data is encrypted at rest by default)
Does CodeDeploy require an instance profile to be attached to both EC2 & on-premises instances.
Only for EC2 - instance profile is automatically create when an IAM role is created for EC2
Generate a data key in encrypted format
Use the KMS command ‘GenerateDataKeyWithoutPlaintext’
Query a DDB table and only retrieve certain attributes
Use a Projection Expression - a comma separated string of the attributes you want.
Prevent message visibility for X minutes when a message enters the SQS queue
To impact whole queue - Implement a delay queue (default - 0 seconds, max - 15 minutes)
To impact individual messages use message timers (not for FIFO)
Best practices for activity workers & tasks wrt. Step Functions
Specify timeout in state machine definitions (avoid getting stuck waiting for a response).
To pass large payloads between states, store data in S3 and pass resource ARN to next state
Diagnose high number/rate of 503 errors on bucket with frequent put operations
Bucket may have versioning enabled, and with many put requests, may have millions of versions of objects. Use S3 inventory tool to generate bucket report.
Measure consumed capacity for DDB queries
Set ‘ReturnConsumedCapacity’ parameter to ‘TOTAL’ on request
Send metadata along with messages between components
Insert metadata using message attributes in SQS
Preserve database for analysis after Beanstalk env. is torn down
Mark database retention as ‘Create Snapshot’
Where to upload lambda function package
Upload application files to S3
Blue Green deployment for new version of Beanstalk application
Create a new env. in the application with the updated application version and perform a URL swap.
Allow CodeBuild integration tests to access private subnet
Provide VPC specific configuration info as part of the codebuild project - e.g., VPC IDs, subnet IDs, security group IDs
Clients cannot connect to internet facing load balancer
LB must be attached to a public subnet
Security group/ACL for subnet must allow traffic to/from client
Allow S3 static website access to S3 bucket
Enable CORS on the bucket
Maintain session states with even distribution across ELB
Use Elasticache (even distro, so can’t use sticky sessions)
What is the EC2 instance store lifetime
Instance store data is ephemeral - will be lost if stopped/restarted.
EBS persists until instance is terminated.
API call to describe an AMI
DescribeImages
Connect instances behind public & private subnets to internet
Create a NAT instance
Reader behaviour in SQS with long polling
Reader will listen to the queue until a message is available, or until timeout
Difference between LSIs and GSIs
LSIs share the same partition key as the primary key. GSIs have a different partition & sort key
Max item size in DDB
400kb
‘ProvisionedThroughputExceededException’ but not exceeding table read capacity throughput
Exceeded max provisioned throughout for one or more GSIs
SS max message retention period
14 days
DDB concurrency control
Optimistic locking - write only proceeds if version in write request matches version on item in table
Using SNS to message different devices & platform
Use platform specific KVPs in a single payload
Ensure application data on EBS is encrypted at rest
Enable encryption and launch an instance type that supports EBS encryption
Pass a stage variable to HTTP url
${stageVariables.<var_name>}</var_name>
What should be done when met with a LambdaThrottledException with cognito events
Perform retry on sync
Sequence of hooks called in CodeDeploy
ApplicationStop -> BeforeInstall -> AfterInstall -> ApplicationStart
How to resolve CodeDeploy error: HEALTH_CONSTRAINTS_INVALID
Reduce the number of health instances required during deployment
A developer is writing a custom script that will run in an Amazon EC2 instance. The script needs to access the local IP address from the instance to manage a connection to an application outside the AWS Cloud. The developer found out that the details about an instance can be viewed by visiting a certain Uniform Resource Identifier (URI).
http://169.254.169.254/latest/meta-data/
A transcoding media service is being developed in AWS. Photos uploaded to Amazon S3 will trigger Step Functions to coordinate a series of processes that will perform image analysis tasks. The final output should contain the input plus the result of the final state to conform to the application’s logic flow.
What should the developer do?
ResultPath field filter is the only one that can control input values and its previous results to be passed to the state output.
Declare a ResultPath field filter on the Amazon States Language Specification.
What should be done to only allow authorized clients to invalidate an API Gateway cache entry when submitting API requests?
- Tick the ‘Require Authorization’ checkbox in the Cache settings of your API via the console
- The client must send a request which contains the ‘Cache-Control: max-age=0’
How should you fix a Lambda function configured with VPC-specific information that cannot connect to the internet via public API?
- Add a NAT gateway to your VPC
- Ensure that the associated security group of the Lambda function allows outbound connections
You have a Lambda function configured with VPC-specific information that cannot connect to the internet via public API. Why would setting up Elastic Network Interfaces (ENIs) not help enabling your Lambda function to connect to the internet?
The ENIs are already automatically set up by Lambda, using the VPC information provided.
A recruitment agency has a large collection of resumes stored in an Amazon S3 bucket. The agency wants to perform an analysis on these files, but for privacy compliance reasons, they need to ensure that certain personally identifiable information (PII) is redacted before being processed by their internal service.
Why is Lambda@Edge not an appropriate solution for this scenario?
Lambda@Edge allows transformations of data for CloudFront distribution at CDN edge locations, for end users. This scenario calls for transformation of data by an internal service.
Lambda@Edge is also a somewhat costly service compared to regular lambda functions.
Why might you get a 403 Forbidden error when using newly generated API keys for a REST API in API gateway, and how would you resolve this?
API keys do not grant access to execute an API with API Gateway without first being associated with a usage plan. This usage plan determines the stages and methods the API key can access.
To fix this, associate the API keys with a usage plan using the CreateUsagePlanKey operation.
How should you provide access for a Node.js application run on a Linux server in an on-premises data center to various AWS services such as S3, DDB, etc.
Create an IAM user with programmatic access. In the application server, create the credentials file at ~/.aws/credentials with the access keys of the IAM user.
You want to release a new firmware update intended only to a specific set of customers, and unauthorized access should be denied with a user authentication process that has minimal latency.
Why would the use of Signed URLs and Signed Cookies in CloudFront not be appropriate here?
This process of authentication has a significant latency, along with signifcant refactoring requirements, compared with use a combination of Lambda@Edge and cognito for filtering out unauthorized requests.
What is the purpose of an RDS Proxy, and how does it achieve this purpose?
RDS Proxy is used to manage a large number of connections from Lambda to an RDS database. It does this by establishing a warm connection pool to the DB. Lambda interacts with the proxy, reusing existing connections instead of create new connections for every function.
How would you configure an AWS Step Functions workflow to allow for a pause while a service works on a task, and only to resume after the service sends a notification to a webhook endpoint?
Why is this cost effective?
Steps functions can be configured to be paused for external system processes using the ‘waitForTaskToken’ option. The step function generates a unique token, which can be retrieved from the context object of the state machine.
The external system can then call the webhook with a ‘SendTaskSuccess’ or ‘…Failure’ while referencing the token.
This is cost effective since the the workflow is paused, and so you are not billed for time when a workflow is paused.
Give an example of when a InvalidParameterValueException would be returned when creating a Lambda function.
When a parameter of the request is invalid, such as providing an IAM role in the CreateFunction API which the Lambda function is unable to assume.
You attempt to create a Lambda function, however the resource already exists. What error would be returned?
ResourceConflictException - 409
What is the difference between the ‘Period’ and ‘Evalution Period’ in cloudwatch?
- Period is the length of time to evaluate the metric or expression and produce a data point for an alarm.
- Evaluation Period is the number of the most recent periods, or data points, to evaluate when determining alarm state.
How can you redirect a user to a geolocation-specific URL using CloudFront?
- Implement a CloudFront function that returns the appropriate URL based on the CloudFront-Viewer-Country.
- Configure the distribution to trigger the function on Viewer request events.
Why is using Route 53 geolocation routing an unsuitable solution to redirecting a user to a geolocation-specific URL using CloudFront?
Route 53 geolocation is primarily for directing traffic to specific resources based on user location for performance or regulatory reasons - not for content personalization based on geolocation.
How would you setup up HTTPS communication between viewers and a CloudFront distribution?
- Set the ‘Viewer Protocol Policy’ to ‘HTTPS Only’
or - Set the ‘Viewer Protocol Policy’ to use ‘Redirect HTTP to HTTPS’
Why would using a self-signed SSL/TLS certificate in the ALB which is stored in a private S3 bucket not help you to setup up HTTPS communication between viewers and a CloudFront distribution?
- You can’t use a self-signed certificate stored in S3. You would need a certificate from ACM or a third-party.
- This would provide you HTTPS communication between origin and CloudFront, not between viewers and CloudFront
A developer is creating an analytics REST API service that is powered by API Gateway. Analysts from a separate AWS account must interact with the service through an IAM role. The IAM role already has a policy that grants permission to invoke the API.
What else should the developer do to meet the requirement without too much overhead?
Set AWS_IAM as the method authorization type for the API.
Attach a resource policy to the PAI that grants permission to the specified IAM role to invoke the ‘execute-api:Invoke’ action.
You have an application hosted on Lambda that typically takes around 5 minutes to process a request. During this time, the application is unresponsive. How can you prevent the application from becoming unresponsive?
Configure the application to asynchronously process the requests and change the invocation type of the Lambda function to Event (i.e., publish an event to the function to trigger it)
You have an application which uses X-Ray to generate trace data. How can you implement a filter expression that will limit the results of a search based on the custom attributes or keys specified? Why this approach?
Add custom attributes as annotations in your segment document.
Annotations are simple key-value pairs that are indexed for use with filter expressions. Use annotations to record data that you want to use to group traces in the console, or when calling the GetTraceSummaries API. X-Ray indexes up to 50 annotations per trace.
Why can you not use metadata to implement a search on custom attribute for X-Ray?
Metadata are key-value pairs with values of any type, including objects and lists, but that are not indexed.
What are the predefined deployment strategies for EC2/On-premises compute platforms?
CodeDeployDefault.OneAtATime, CodeDeployDefault.HalfAtATime, CodeDeployDefault.AllAtOnce
Why is CodeDeployDefault.HalfAtATime not quicker than CodeDeployDefault.LambdaCanary10Percent5Minutes for deploying Lambda functions?
It is not a viable deployment strategy for Lambda - it is only for EC2/On-premises
How can you establish end-to-end encryption using an AWS applications fronted by a CloudFront distribution?
Configure both Origin Protocol Policy and Viewer Protocol Policy to use HTTPS