aws-ops
AWS環境特有の運用・開発ルール
When & Why to Use This Skill
This Claude skill provides a specialized set of operational and development guidelines for AWS environments. It focuses on streamlining cloud infrastructure management by addressing common pitfalls in AWS CLI authentication, Lambda deployments, and complex API Gateway with Cognito integrations. By implementing these best practices, teams can ensure more reliable CloudFormation deployments and secure, standardized cloud operations.
Use Cases
- API Gateway & Cognito Integration: Correctly configuring CORS for preflight OPTIONS requests and ensuring the proper 'Authorization' header format without the Bearer prefix.
- Automated Deployment Management: Using resource renaming techniques in CloudFormation to force-trigger API Gateway deployments when methods or authorizers are updated.
- AWS CLI Operational Security: Implementing mandatory authentication status checks before executing CLI commands to prevent unauthorized access or execution errors.
- Infrastructure as Code Optimization: Standardizing CloudFormation templates with UTF-8 encoding and English descriptions to prevent character encoding errors during CLI-based deployments.
| name | aws-ops |
|---|---|
| description | AWS環境特有の運用・開発ルール |
AWS 特有の運用原則
- CLI 認証: AWS CLI を使用する場合はコマンド出力前に認証状況を確認すること。
- 自動生成ファイル:
lambda_packageは自動生成されるパッケージなので修正不要。
API Gateway & Cognito 連携ルール
- CORS (OPTIONS) の認証除外: API Gateway に Cognito Authorizer を導入する場合、ブラウザのプリフライトリクエスト (
OPTIONS) は認証を通過できないため、OPTIONSメソッドのAuthorizationTypeは必ずNONEに設定すること。 - Authorization ヘッダー形式: Cognito User Pool Authorizer を使用する場合、デフォルトでは
Authorizationヘッダーに ID トークンを直接(Bearerプレフィックスなしで)含める必要がある。 - デプロイの強制反映: CloudFormation で API Gateway のメソッドやオーソライザーを変更した場合、ステージへの反映には新しい
AWS::ApiGateway::Deploymentリソースが必要になる。既存のデプロイリソース名を変更(例:ApiGatewayDeploymentV2)することで強制的に再デプロイをトリガーできる。 - テンプレートのエンコーディング: CloudFormation テンプレートに日本語を含めると AWS CLI でのデプロイ時にエンコーディングエラーが発生する場合がある。可能な限り
DescriptionやParameterの説明文には英語を使用し、ファイルは UTF-8 (BOM なし) で保存すること。