diff --git a/knowledge base/cloud computing/aws/codedeploy.md b/knowledge base/cloud computing/aws/codedeploy.md index 6b59a54..81aa433 100644 --- a/knowledge base/cloud computing/aws/codedeploy.md +++ b/knowledge base/cloud computing/aws/codedeploy.md @@ -17,17 +17,17 @@ Automates application deployments to EC2 and on-premises instances, Lambda funct Application content can be stored in S3 buckets, or GitHub or Bitbucket repositories.
No changes are needed to the application itself. -| Component | Summary | -| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------- | -| Application | Name that uniquely identifies the application resources to deploy, and to deploy to. | -| Compute platform | The platform on which applications are deployed an application. | -| Deployment configuration | Set of rules and success/failure conditions used during deployments. | -| Deployment group | Set of individual EC2/on-premise instances to deploy to, if using them. | -| Deployment type | Method used for deployments to instances in a deployment group.
Available deployment types are _in-place_ and _blue/green_. | -| IAM instance profile | IAM role for EC2 instances.
It must have the permissions required to access the application code. | -| Revision | Application versions. | -| Service role | IAM role granting permissions to CodeDeploy to access AWS resources. | -| Target revision | The application revision currently targeted for deployment. | +| Component | Summary | +| ------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| Application | Name used as reference to ensure the correct components are chosen during a deployment | +| Compute platform | Platform on which applications are deployed.
Choices include _EC2/On-Premises_, _AWS Lambda_, and _Amazon ECS_. | +| Deployment configuration | Set of rules and success/failure conditions used during deployments | +| Deployment group | Set of tagged EC2/on-premise instances to deploy to, if used | +| Deployment type | How applications are made available to instances in a deployment group.
Choices include _in-place_ and _blue/green_. | +| IAM instance profile | IAM role for EC2 instances.
It must have the permissions required to access the application code. | +| Revision | Application versions | +| Service role | IAM Role used by CodeDeploy to access AWS resources | +| Target revision | Application revision currently targeted for deployment | + +1. [TL;DR](#tldr) +1. [Snowflake CLI](#snowflake-cli) +1. [Further readings](#further-readings) + 1. [Sources](#sources) + +## TL;DR + +
+ Setup + +```sh +# Install Snowflake CLI. +# Get it from the [Snowflake CLI repository]. +curl -fsSLO 'https://sfc-repo.snowflakecomputing.com/snowflake-cli/linux_aarch64/3.4.1/snowflake-cli-3.4.1.aarch64.deb' \ +&& dpkg -i 'snowflake-cli-3.4.1.aarch64.deb' +curl -fsSLO 'https://sfc-repo.snowflakecomputing.com/snowflake-cli/darwin_arm64/3.4.1/snowflake-cli-3.4.1-darwin-arm64.pkg' \ +&& sudo installer -pkg 'snowflake-cli-3.4.1-darwin-arm64.pkg' -target '/' +curl -fsSLO 'https://sfc-repo.snowflakecomputing.com/snowflake-cli/linux_aarch64/3.4.1/snowflake-cli-3.4.1.aarch64.rpm' \ +&& rpm -i 'snowflake-cli-3.4.1.rpm' + +# Check it works. +snow --help +``` + +
+ + + + + +## Snowflake CLI + +Refer [Snowflake CLI]. + +Meant to replace the SnowSQL tool. + +Download from the [Snowflake CLI repository]. + +```sh +curl -fsSLO 'https://sfc-repo.snowflakecomputing.com/snowflake-cli/darwin_arm64/3.4.1/snowflake-cli-3.4.1-darwin-arm64.pkg' \ +&& sudo installer -pkg 'snowflake-cli-3.4.1-darwin-arm64.pkg' -target '/' +``` + +## Further readings + +- [Website] + +### Sources + +- [Documentation] +- [Snowflake CLI] + + + + + + + +[documentation]: https://docs.snowflake.com/en/ +[website]: https://www.snowflake.com/en/ +[snowflake cli]: https://docs.snowflake.com/en/developer-guide/snowflake-cli/index +[snowflake cli repository]: https://sfc-repo.snowflakecomputing.com/snowflake-cli/index.html + + diff --git a/knowledge base/task.md b/knowledge base/task.md index dafc7c9..c0b8f2e 100644 --- a/knowledge base/task.md +++ b/knowledge base/task.md @@ -17,6 +17,8 @@ Task runner aiming to be simpler and easier to use than [GNU Make]. Taskfiles are Task's Makefile counterpart.
Taskfiles are written in YAML. +_Tasks_ in Task are what _targets_ are for Make. + Task leverages `mvdan.cc/sh` to run commands, which is a native Go shell interpreter.
It allows to write `sh`/`bash` commands and have them work even where `sh` or `bash` are usually not available (e.g.: Windows) as long as any called executable is available in `PATH`. @@ -26,9 +28,9 @@ Pros: - Taskfiles are more readable than Makefiles. Specifically: - - No need to use tabs. - - No need for special symbols. - - Easier environment variables management. + - There is no need to explicitly use tabs in tasks' definitions. + - There is no need for special symbols, like `@`. + - Environment variables management is easier. Cons: @@ -36,7 +38,7 @@ Cons: That makes them very much similar to \[[Gitlab] / [Azure Devops]]'s pipelines, and if one has any experience with them one knows what a pain that can be. -Uses Go's [text/template] package to interpolate values. +Uses Go's [text/template] and [slim-sprig] packages to interpolate values. Environment variables (`env: {}, dotenv: []`) are available in the shell used by commands.
Variables (`vars: {}`) are **only** available to Task while executing templates, but **will default to environment @@ -96,7 +98,7 @@ task --dry --verbose 'lint' 'validate:ansible' task --dry 'bootstrap' ``` - If task names are omitted, a task named `default` will be assumed. + If task names are omitted, Task will try and execute a task named `default`. ## Variables @@ -260,12 +262,12 @@ Force the print using `-v, --verbose` when `silent` is set to `true`, or set it - [Website] - [Github] -- [Demystification of taskfile variables] ### Sources - [Usage] - [Stop Using Makefile (Use Taskfile Instead)] +- [Demystification of taskfile variables] [demystification of taskfile variables]: https://medium.com/@TianchenW/demystification-of-taskfile-variables-29b751950393 +[slim-sprig]: https://github.com/go-task/slim-sprig [stop using makefile (use taskfile instead)]: https://dev.to/calvinmclean/stop-using-makefile-use-taskfile-instead-4hm9 [text/template]: https://pkg.go.dev/text/template diff --git a/snippets/aws/other commands.fish b/snippets/aws/other commands.fish index 5fed7e3..ddf19b7 100644 --- a/snippets/aws/other commands.fish +++ b/snippets/aws/other commands.fish @@ -362,6 +362,9 @@ aws kms decrypt --key-id 'arn:aws:kms:eu-west-1:123456789012:key/d74f5077-811b-4 --output 'text' --query 'Plaintext' \ | base64 --decode > 'decryptedKey.bin' +aws kms list-aliases --query 'Aliases[?AliasName.contains(@,`staging`)]' +aws kms list-aliases --query 'Aliases[?AliasName.contains(@,`prod`)]|[*].{"Alias":@.AliasName,"KeyId":@.TargetKeyId}' + ### # RDS diff --git a/snippets/kubectl.sh b/snippets/kubectl.sh index becabca..ac1c3c4 100644 --- a/snippets/kubectl.sh +++ b/snippets/kubectl.sh @@ -74,3 +74,8 @@ kubectl get --raw "/api/v1/nodes/ip-172-31-69-42.eu-west-1.compute.internal/prox # Get ephemeral storage usage for pods kubectl get --raw "/api/v1/nodes/ip-172-31-69-42.eu-west-1.compute.internal/proxy/stats/summary" \ | jq '.pods[] | select(.podRef.name == "gitlab-runner-59dd68c5cb-9vcp4")."ephemeral-storage"' +# Dynamic way for the same action +POD_NAME='gitlab-runner-6ddd58fcb6-c9swk' POD_NAMESPACE='gitlab' \ +&& kubectl get pods -n "$POD_NAMESPACE" "$POD_NAME" -o jsonpath='{.status.hostIP}' | tr '.' '-' \ +| xargs -I '%%' kubectl get --raw '/api/v1/nodes/ip-%%.eu-west-1.compute.internal/proxy/stats/summary' \ +| jq --arg 'podName' "$POD_NAME" '.pods[] | select(.podRef.name == $podName)."ephemeral-storage"'