Aws Developer Flashcards
Aws kvm
Kernel based virtual machine is an open sourced hypervisor for virtualizing compute infrastructure
VPC 2 facts
5 CIDR blocks per VPC
No overlap
Range formula
2^(32-x)
Hypervisor is a __ layer
Software
Load balance within region use ___
Across region use
ELB
Route53
What is best practice for using dev, test, prod
Enhanced security…
Create a different account for each so if one is accessed/hacked prod is safe
Different accounts
VPC needs
Internet gateway
Route table
Assign pub IP, private IP
EIP is needed for
EIP stays with account
Elastic IP address gives you a persistent IP address so you can stop instance and will have same IP when restart
EIP stays with account
Why should an EIP be attached to
The advantage of associating the Elastic IP address with the Elastic network interface instead of directly with the instance is that you can move all the attributes of the network interface from one instance to another in a single step
AWS code commit is powered by
s3
IAM can?
Can help with federated users
IAM best practice
We strongly recommend that you do not use the root user for your everyday tasks, even the administrative ones. Instead, adhere to the best practice of using the root user only to create your first IAM user. Then securely lock away the root user credentials and use them to perform only a few account and service management tasks.
Two ways IAM helps secure your account
Also allows ___?
Multi-factor authentication (MFA)
You can add two-factor authentication to your account and to individual users for extra security. With MFA you or your users must provide not only a password or access key to work with your account, but also a code from a specially configured device.
Identity federation
You can allow users who already have passwords elsewhere—for example, in your corporate network or with an internet identity provider—to get temporary access to your AWS account.
Programmatic access can be accessed with
Note that for this the user will have to
AWS API
AWS CLI
AWS SDK
and other tools
Access key ID and Secret access key
AWS SAM Build command:
The sam build command processes your AWS SAM template file, application code, and any applicable language-specific files and dependencies. The command also copies build artifacts in the format and location expected for subsequent steps in your workflow.
how to grant access to your AWS account
To allow users access to the AWS Management Console and AWS Command Line Interface (AWS CLI), you have two options. The first one is to create identities and allow users to log in using a username and password managed by the IAM service. The second approach is to use federation
to allow your users to use their existing corporate credentials to log into the AWS console and CLI.
Each approach has its use cases. Federation is generally better for enterprises that have an existing central directory or plan to need more than the current limit of 5,000 IAM users.
Note: Access to all AWS accounts is managed by AWS IAM. Regardless of the approach you choose, make sure to familiarize yourself with and follow IAM best practices.
AWS CodePipeline is primarily used
AWS CodePipeline is for automating the build, test, and deploy phases of your release process every time there is a code change.
AWS Data Pipeline
AWS Data Pipeline is used for automating the movement and transformation of data between different AWS compute and storage services, as well as on-premises data sources, at specified intervals. It integrates with AWS services such as AWS services such as Amazon S3, Amazon RDS, Amazon DynamoDB, and Amazon EMR. It is not used for managing the coordination of multiple AWS Services into serverless workflows.
AWS Data Pipeline
AWS Data Pipeline is used for automating the movement and transformation of data between different AWS compute and storage services, as well as on-premises data sources, at specified intervals. It integrates with AWS services such as AWS services such as Amazon S3, Amazon RDS, Amazon DynamoDB, and Amazon EMR. It is not used for managing the coordination of multiple AWS Services into serverless workflows.
AWS cloudFormation
Simplify infrastructure management building code templates (json or YAML)
Quickly replicate infrastructure by reusing templates
Easily control and track changes and rollback actions and version control
StackSets let’s you provision common set of AWS resources across multiple accounts and regions in a single cloudFormation template
Can build custom extensions to a stack template with AWS lambda
AWS cloudFormation stacks
How to make changes?
Manage related resources as a single unit called a stack
All the resources provisioned in a stack are defined in the cloudFormation temple
To update a stack create a CHANGE SET
Summary of proposed changes
Let's you see how your changes might impact the resources in the current stack
cloudFormation Template keys
Description
Metadata
Parameters
Rules
Mappings
Conditions
Transform
Resources
Outputs
AWS SAM compiles into
cloudFormation
Security in the cloud is composed of six areas:
Foundations
Identity and access management
Detection
Infrastructure protection
Data protection
Incident response
CodeBuild
A fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy
A build project defines how CodeBuild will run a build. It includes information such as where to get the source code, which build environment to use, the build commands to run, and where to store the build output.
A build environment is the combination of operating system, programming language runtime, and tools used by CodeBuild to run a build.
The build specification is a YAML file that lets you choose the commands to run at each phase of the build and other settings. Without a build spec, CodeBuild cannot successfully convert your build input into build output or locate the build output artifact in the build environment to upload to your output bucket.If you include a build spec as part of the source code, by default, the build spec file must be named buildspec.yml and placed in the root of your source directory.
A collection of input files is called build input artifacts or build input and a deployable version of a source code is called build output artifact or build output.
AWS CodeDeploy
A fully managed deployment service that automates software deployments to a variety of compute services such as Amazon EC2, AWS Fargate, AWS Lambda, and your on-premises servers.
An Application is a name that uniquely identifies the application you want to deploy. CodeDeploy uses this name, which functions as a container, to ensure the correct combination of revision, deployment configuration, and deployment group are referenced during a deployment.
Compute platform is the platform on which CodeDeploy deploys an application (EC2, ECS, Lambda, On-premises servers).
Deployment configuration is a set of deployment rules and deployment success and failure conditions used by CodeDeploy during a deployment.
Deployment group contains individually tagged instances, Amazon EC2 instances in Amazon EC2 Auto Scaling groups, or both.In an Amazon ECS deployment, a deployment group specifies the Amazon ECS service, load balancer, optional test listener, and two target groups. It also specifies when to reroute traffic to the replacement task set and when to terminate the original task set and ECS application after a successful deployment.In an AWS Lambda deployment, a deployment group defines a set of CodeDeploy configurations for future deployments of an AWS Lambda function.
In an EC2/On-Premises deployment, a deployment group is a set of individual instances targeted for a deployment.In an in-place deployment, the instances in the deployment group are updated with the latest application revision.In a blue/green deployment, traffic is rerouted from one set of instances to another by deregistering the original instances from a load balancer and registering a replacement set of instances that typically has the latest application revision already installed.
for an AWS Lambda deployment is a YAML- or JSON-formatted application specification file (AppSpec file) that specifies information about the Lambda function to deploy. The revision can be stored in Amazon S3 buckets.for an Amazon ECS deployment is a YAML- or JSON-formatted file that specifies the Amazon ECS task definition used for the deployment, a container name and port mapping used to route traffic, and optional Lambda functions run after deployment lifecycle events.for an EC2/On-Premises deployment is an archive file that contains source content (source code, webpages, executable files, and deployment scripts) and an application specification file. The revision can be stored in Amazon S3 buckets or GitHub repositories.
AWS CodeDeploy lifecycle events
ApplicationStop DownloadBundle BeforeInstall Install AfterInstall ApplicationStart ValidateService
AWS CodeDeploy deployment with lambda
You must choose one of the following deployment configuration types to specify how traffic is shifted from the original Lambda function version to the new version:
Canary: Traffic is shifted in two increments. You can choose from predefined canary options that specify the percentage of traffic shifted to your updated Lambda function version in the first increment and the interval, in minutes, before the remaining traffic is shifted in the second increment.
Linear: Traffic is shifted in equal increments with an equal number of minutes between each increment. You can choose from predefined linear options that specify the percentage of traffic shifted in each increment and the number of minutes between each increment.
All-at-once: All traffic is shifted from the original Lambda function to the updated Lambda function version all at once.
If you don’t specify a deployment configuration, CodeDeploy uses the
If you don’t specify a deployment configuration, CodeDeploy uses the CodeDeployDefault.OneAtATime deployment configuration.
Monitoring CodeDeploy
Monitoring
In CodeDeploy, you should at the minimum monitor the following itemsDeployment events and statusInstance events and statusTools and ServicesAmazon CloudWatch Alarms, Events and LogsAWS CloudTrailAmazon SNSAWS CodeDeploy console
S3 is
“Read after Write Consistent” for new PUTS
“Eventually Consistent” for Overwrite PUTS
DELETE is eventually Consistent
SSE-KMS Offers additional protection than sse-s3
AWS KMS Allows for you to have separate permissions fot the use of envelope key
Provides you with audit trail when the key was used and by whom
Create/manage the encryption key by yourself if you wish
More flexible than sse-s3
Multipart upload
If Object size 100MB
Initiation
Upload parts
Completion
Cross region replication (crr) when you delete a bucket
Without versioning it deletes the replica in the destination bucket (adds delete marker)
With version Id does not replicate the deletion marker
S3 crr cross region replication is enabled for encryption types:
SSE-S3 or SSE-KMS
CodeDeploy AppSpec.yml keys
Version: OS: Files: Hooks: BeforeInstall: AfterInstall: ApplicationStart: ApplicationStop:
CodeDeploy agent is not required for
ECS or lambda
CodeDeploy deployment types
In-place only for ec2 on-prem
Load balancer: Fleet of ec2
All at once Half at once One at a time Moment where cannot access app Blue/Green Will not interrupt existing env
Customer traffic never affected ECS and Lambda only have blue/green
VPC flow logs
Apis entering exiting vpc
DynamoDB supports two kinds of indexes:
Global secondary index – An index with a partition key and sort key that can be different from those on the table.
Local secondary index – An index that has the same partition key as the table, but a different sort key.
Lambda recursive fxn resolved by
Avoid using recursive code in your Lambda function, wherein the function automatically calls itself until some arbitrary criteria is met. This could lead to unintended volume of function invocations and escalated costs. If you do accidentally do so, set the function reserved concurrency to 0 immediately to throttle all invocations to the function, while you update the code.
Lambda You can configure the following items for a published lambda function version:
You can configure the following items for a published function version:
Triggers
Destinations
Provisioned concurrency
Asynchronous invocation
Elastic Beanstalk supports two methods of saving configuration option settings. Configuration files in YAML or JSON format can be included in your application’s source code in a directory named ?
.ebextensions
.ebextensions have the lowest level of precedence and are overridden by settings at any other level.
To use configuration files, create a folder named .ebextensions at the top level of your project’s source code. Add a file with the extension .config and specify options in the following manner:
option_settings: - namespace: namespace option_name: option name value: option value - namespace: namespace option_name: option name value: option value For example, the following configuration file sets the application's health check url to /health:
healthcheckurl.config