AWS - Dev Tools, CLI, CICD Flashcards
Key terms for the AWS CI/CD pipeline?
- CodeCommit = source control
- CodeBuild = manages builds and testing
- CodeDeploy = deploys to EC2, Fargate, Lambda, on-prem, etc
- CodePipeline = manages the CI/CD pipeline
What is the CodeBuild config file called? 4 main stages? 2 other things you can define?
buildspec.yml
- Has to be located in the root of the source
Stages:
1. install - installing packages from the build env (frameworks)
2. pre_build - sign in to things or install dependencies
3. build - commands run during the build process
4. post_build - package things up, push Docker image, do explicit notifications, etc.
Other things you can define:
1. Environment variables, which can integrate with the Parameter Store or Secrets Manager
2. Artifacts - what stuff to put where
What is the CodeDeploy config file called?
appspec.yml (or .json)
What are the 8 possible deployment targets of CodePipeline?
- CodeDeploy
- EC2 / ECS (also can use Blue/Green deployment model)
- Elastic Beanstalk
- Service Catalog
- Alexa Skills Kit
- S3
- OpsWorks
- CloudFormation
How do you set up authentication and authorization for CodeCommit, CodeDeploy, CodePipeline?
Authentication:
> Create one of the following in IAM:
- HTTPS Git Credentials (username / password)
- SSH Keys
Authorization:
> Configured using IAM Identity Policies. Very granular.
What two things can be generated from Code* events?
- Notifications
- Send to either SNS or Chatbot (Slack)
- Triggers
- Invoke Lambda function or SNS notification
What are the main components used by CodePipeline?
Pipelines are the main components, which are built from:
- Stages, which are built from sequential or parallel:
- Actions, which can consume or generate:
- Artifacts
What system stores a record of CodePipeline events?
How to find events coming either from API calls or human interaction?
- Any state changes generate events that go to Event Bridge (Success, Failed, Cancelled)
- Use CloudTrail to monitor API calls
- Use the Console UI to monitor human interaction
What service uses Appspec.yml? What 2 main components does it specify?
- CodeDeploy. Can also be called Appspec.json.
- Contains both configs and lifecycle event hooks.
What 3 main components can the configs section define in the CodeDeploy Appspec.yml / json file?
- Files: applies to EC2 & on-prem servers. Determines which things to be installed.
- Permissions: details any special permissions that should be applied to be files, directories, etc. in the Files section.
- ONLY applies to EC2 or on-prem servers.
- Resources -> applies to ECS & Lambda
- ECS: contains task definition, or container and port details = configs for the thing running your application
- Lambda: contains name, alias, current version, target version of a Lambda function
How do Lifecycle Event Hooks work in the CodeDeploy Appspec.yml / json file?
- If you’re using EC2 or on-prem servers, these hooks each run 1 script
- For Lambda or ECS, these hooks specify Lambda functions to run at each step.
- Examples:
- ApplicationStop: used to prepare for the deployment
- DownloadBundle: before copying files to a local location
- BeforeInstall
- Install
- AfterInstall
- ApplicationStart
- ValidateService: Enables CodeDeploy to validate whether the deployment worked as expected. You can run whatever checks or query logs, etc.