terraform で map 型の値を key 順にソートした上で value のリストを取得する

terraform で map 型の値を key 順にソートした上で value のリストを取得する

terraform で map 型を for で整形した際に key を昇順にソートして並べてくれます。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
> {for k, v in {"a":3, "c":2, "d":1}: v => k}

{
"1" = "d"
"2" = "c"
"3" = "a"
}

> values({for k, v in {"a":3, "c":2, "d":1}: v => k})

[
"d",
"c",
"a",
]

これを利用し、data リソースで取得した Subnet ID を AZ 順 (a → c → d) に list で取得してみます。

続きを読む
AWS ElastiCache Redis バージョンアップ&ノードタイプ変更時の注意点

AWS ElastiCache Redis バージョンアップ&ノードタイプ変更時の注意点

AWS より cache.m3 系から cache.m5 系へのアップグレードを促されました。

One or more of your Amazon ElastiCache clusters is running on our previous generation node type cache.m3.medium. We strongly recommend that you migrate to one of our latest generation node types, and with ElastiCache it is fast and easy to choose a new instance type for your cluster.

Our latest generation node types offer benefits such as better price per compute performance, higher-performing CPUs, improved memory, network performance, and ElastiCache optimizations such as enhanced I/O that provides improved throughput per node.

Migration to the latest generation node types is available via our scale-up feature. To scale up your cluster:
First, determine the best upgrade path from your previous generation node type(s) to the latest generation, see https://aws.amazon.com/elasticache/previous-generation

アップグレード時の注意事項をまとめます。

結論

続きを読む

RPi opencv で笑顔検知して Slack に通知するカメラを作った


概要

以前 RPi bullseye でカメラモジュール周りの設定が変わったことについて記載させていただきました。

RPi で opencv をセットアップする記事をネット上でいくつか見ましたが
bullseye より前のバージョンでの場合が多く、うまくいかないということが多かったです。

その為、 bullseye での設定をまとめます。

続きを読む

fix the system should be configured for the legacy camera stack


概要

Raspberry PI bullseye で raspistill -o test.jpg 実行時に掲題のエラーが発生しました。

1
2
3
$ raspistill -o test.jpg

the system should be configured for the legacy camera stack

以下公式にしっかりと bullseye 以降は libcamera ベースのスタックのみが含まれている、と記載されていました。

https://www.raspberrypi.com/documentation/accessories/camera.html

Raspberry Pi OS images from Bullseye onwards will contain only the libcamera-based stack.

続きを読む

AWS CodeBuild で git lfs pull する


概要

CodePipline のソースアクションで GitHub からチェックアウトする処理がエラーとなり、異常終了する事象が発生しました。

チェックアウトする Rails プロジェクトの app/assets/images/ 以下のファイル容量が肥大化していたことが要因でした。

上記を回避すべく Git LFS を導入した話です。

続きを読む