Deployment as Code Flashcards
What are benefits of Continuous Delivery?
Reduced manual effort to ensure code changes are tested
Developers can focus on software
Changes are delivered faster
What is AWS CodePipeline?
A continuous integration and delivery service for fast and reliable application and infrastructure updates.
What is a pipeline in AWS Pipeline?
A pipeline is the overall workflow that defines what transformations software changes will undergo
What are the AWS Pipeline components?
Pipeline
Revision
Stage
Action
What is a revision in AWS Pipeline?
A revision is a work item that passes through a pipeline.
A pipeline can have multiple revisions flowing through it at the same time but a single stage can only processes one revision at a time.
What is a stage in AWS Pipeline?
A stage is a group of one or more actions.
Each stage must have a unique name.
Should any action fail, the entire stage fails.
What is an action in AWS Pipeline?
An action defines the work to perform on a revision. Pipeline actions can run in parallel. If all actions succeed the revision moves to the next stage.
What types of actions does AWS Pipeline offer?
Source Build Test Deploy Approval Invoke Artifact
What does the source action do in AWS Pipeline?
Defines location of source files, Modifications to the source files trigger deployments in a pipeline.
Amazon S3
AWS CodeCommit
GitHub
What does the build action do in AWS Pipeline?
It can compile source code, run unit tests, or perform other tasks that produce artifacts.
Good to import large assets that are not part of the source bundle.
AWS CodeBuild CloudBees Jenkins Solano CI TeamCity
What does the test action do in AWS Pipeline?
Run various tests against source and compiled code, such as lint or syntax tests on source code, and unit tests on compiled code.
AWS CodeBuild BlazeMeter Ghost Inspector Hewlett Packard Enterprise (HPE) StormRunner Load Nouvola Runscope
What does the deploy action do in AWS Pipeline?
Taking compiled or prepared assets and installing them on EC2 instances, on-premises server, serverless function, or deploying and updating infrastructure with CloudFormation.
What does the approval action do in AWS Pipeline?
A manual gate that controls whether a revision passes to the next stage. Further progress is halted until an IAM user or role with the codepipeline::PutApprovalResult action in its policy approves.
7 days limit.
How to notify someone that approval is pending within in an approval action in AWS Pipeline?
Send an AWS SNS notification.
Use check URL.
What does the invoke action do in AWS Pipeline?
Invoke actions execute lambda functions. Allows arbitrary code to run in a pipeline.
What does the artifact action do in AWS Pipeline?
Artifacts can pass between actions or stages in a pipeline.
Every stage makes use of the S3 artifact bucket, defined during pipeline creation.
Unique an matching input and output artifact names have to be defined to transition between stages.
What is a transition in AWS Pipeline?
Connects stages in pipeline. Can be disabled which halts the pipeline but can be resumed afterwards.
Are build and deploy actions required in AWS Pipelineß
If a build provider is NOT selected then a deployment provider has to be selected.
If a build provider is selected, then the deployment provider is optional.
How to invoke a pipeline?
In CodePipeline console: Select Release Change
AWS CLI:
aws codepipeline start-pipeline-execution –name SamplePipeline
How to retry a failed action in a pipeline?
Either use the console or CLI:
aws codepipeline retry-stage-execution
Fails, if retry is in progress
Other actions in the same stage have not completed
Pipeline itself has changed
How to create a cross-account pipeline?
pipeline account: Contains the pipeline
target account: Account to deploy resources to
Pipeline account steps:
- Create an AWS Key Management Service (AWS KMS) key in the pipeline account, and apply it to the pipeline. This key encrypts artifacts that pass between stages, and you configure it to allow access to the target account in a later step. After you create the AWS KMS key, you apply a key policy that allows access to the key by both the AWS CodePipeline service role in the pipeline account and the Amazon Resource Name (ARN) of the target account.
- Apply a bucket policy to the Amazon S3 bucket for the pipeline. This policy must grant access to the bucket by the target account.
- Create a policy that allows the pipeline account to assume a role in the target account. You attach this policy to the AWS CodePipeline service role.
Target account steps:
- Create an IAM role that contains a trust relationship policy that allows the pipeline account to assume the role.
- Create an IAM policy that allows access to deploy to the pipeline’s resources. Attach this policy to the IAM role.
- Create an IAM policy that allows access to the Amazon S3 bucket in the pipeline account, and attach it to the IAM role. After completing the previous steps, revisions that pass through the pipeline account will be accessible by the target account.
What is AWS CodeCommit?
AWS CodeCommit leverages the Git framework, and it is fully compatible with existing tooling. There are a number of benefits to this service, such as the following:
Automatic encryption in-transit and at rest.
Scaling to handle rapid release cycles and large repositories.
Access control to the repository using IAM users, IAM roles, and IAM policies. Hypertext Transfer Protocol Secure (HTTPS) and Secure Shell (SSH) connectivity.
How to connect to CodeCommit via HTTPS?
To use AWS CodeCommit with HTTPS credentials, you must first add them to an IAM user with sufficient permissions to interact with the repository. To create Git credentials for your IAM user, you open the IAM console, and select the user who will need to authenticate to the AWS CodeCommit repository
via HTTPS.
AWS generates security credentials for the usernames and passwords, and they cannot
be set to custom values.
After you configure your Git CLI/application to use the repository’s HTTPS endpoint and the username/password, you will have access to the AWS CodeCommit repository.
How to connect to CodeCommit via SSH?
With SSH authentication, there is no need to install the AWS CLI to connect to your reposi- tory. However, you perform some additional configuration tasks.
Your IAM user must have the ability to manage their own SSH keys.
To accomplish this, you add the IAMUserSSHKeys managed policy to the account.
Scaling to handle rapid release cycles and large repositories.
For Windows users, install a bash emulator, such as Git Bash.
To configure SSH authentication to AWS CodeCommit repositories, follow these steps:
In the IAM console, select the user account you want to modify.
Upload the public SSH key on the Security Credentials tab.
Copy the SSH key identity (ID). This follows the form APKAEIGHANK3EXAMPLE.
Update the ~/.ssh/config file on your workstation to include these contents:
Host git-codecommit.*.amazonaws.com User YOUR_SSH_KEY_ID
IdentityFile YOUR_PRIVATE_KEY_FILE
To verify the configuration, test a simple SSH connection to the AWS CodeCommit endpoint, as shown here: # Format: ssh git-codecommit.[REGION_CODE].amazonaws.com ssh git-codecommit.us-east-1.amazonaws.com
Can you authenticate to CodeCommit via IAM credentials, as well?
It is also possible to authenticate to AWS CodeCom- mit with IAM credentials and the AWS CodeCommit credential helper. The credential helper translates IAM credentials to those that AWS CodeCommit can use to perform Git actions, such as to clone a repository or merge a pull request. To configure the credential helper on your workstation, do the following:
1. Install and configure the AWS CLI.
2. Install Git.
3. Configure Git to leverage the credential helper from the AWS CLI with these commands:
git config –global \
credential.helper ‘!aws codecommit credential-helper $@’
git config –global credential.UseHttpPath true
Once complete, HTTPS interactions with the AWS CodeCommit repository should work
as expected.
Which IDE support git CodeCommit authentication via git credentials and IAM?
AWS CodeCommit integrates automatically with any development tools that support IAM credentials. Additionally, after you set up HTTPS Git credentials, you are able to use any tools that support this authentication mechanism instead.
Examples of supported integrated development environment (IDE) include the following:
AWS Cloud9
Eclipse
IntelliJ
Visual Studio
What is a repository in CodeCommit?
This is the location where you store source code files, track revisions, and merge contributions (commits). When you create a repository, it will contain an empty master branch by default.