From da29538ebf7d6a615b808d88470591dc50923684 Mon Sep 17 00:00:00 2001 From: Daisuke Date: Thu, 1 Jan 2026 09:18:44 +0900 Subject: [PATCH 1/2] Specify monospace font for code blocks --- src/styles/global.css | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/styles/global.css b/src/styles/global.css index 5a9b61d..0ebece4 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -88,4 +88,9 @@ h1 { display: none; } -} \ No newline at end of file +} + +pre, +code { + font-family: "JetBrains Mono", "Fira Code", "Menlo", "Consolas", monospace; +} From 825500d8941bc71aff7b5ee277619549da2fea07 Mon Sep 17 00:00:00 2001 From: Daisuke Date: Thu, 1 Jan 2026 09:19:26 +0900 Subject: [PATCH 2/2] Add blog post: AWS CLI commands for CloudFormation stacks --- src/blog/post-4.md | 102 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 src/blog/post-4.md diff --git a/src/blog/post-4.md b/src/blog/post-4.md new file mode 100644 index 0000000..ba70660 --- /dev/null +++ b/src/blog/post-4.md @@ -0,0 +1,102 @@ +--- +title: 'AWS CLI Commands for Managing CloudFormation Stacks' +pubDate: 2026-01-01 +author: 'Nakahara Daisuke' +tags: ["AWS"] +--- + +This article is a collection of AWS CLI commands used while updating the CloudFormation stacks that support this blog. + +Each command is grouped by its purpose, focusing on practical workflows for managing CloudFormation stacks safely and explicitly. + +### Assume an IAM Role Temporarily +Use the following command to assume an IAM role temporarily and output the credentials as a JSON file. +```bash +aws sts assume-role \ + --role-arn arn:aws:iam::000000000000:role/MyRole \ + --role-session-name my-session-name \ + --profile my-profile \ + > /tmp/creds.json +``` + +Set environment variables based on the generated JSON credentials file. +```bash +export AWS_ACCESS_KEY_ID=$(jq -r '.Credentials.AccessKeyId' /tmp/creds.json) +export AWS_SECRET_ACCESS_KEY=$(jq -r '.Credentials.SecretAccessKey' /tmp/creds.json) +export AWS_SESSION_TOKEN=$(jq -r '.Credentials.SessionToken' /tmp/creds.json) +``` + +### Create a New CloudFormation Stack + +Use this command to create a new CloudFormation stack. +```bash +aws cloudformation create-stack \ + --stack-name my-stack-name \ + --template-body file://my-template.yaml \ + --capabilities CAPABILITY_NAMED_IAM \ + --region ap-northeast-1 +``` + +### Update an Existing Stack with Parameters + +Use this command to update an existing stack while passing parameters. +```bash +aws cloudformation update-stack \ + --stack-name my-stack-name \ + --template-body file://my-template.yaml \ + --capabilities CAPABILITY_NAMED_IAM \ + --region ap-northeast-1 \ + --parameters ParameterKey=KeyName,ParameterValue="Value" +``` + +### Manually Start a Stack Rollback + +Use this command to manually continue a stack rollback. +```bash +aws cloudformation continue-update-rollback \ + --stack-name my-stack-name \ + --region ap-northeast-1 +``` + +### Wait for Stack Rollback Completion + +Use this command to wait until the rollback process is complete. +```bash +aws cloudformation wait stack-rollback-complete \ + --stack-name my-stack-name \ + --region ap-northeast-1 +``` + +### Create a Change Set to Import Existing Resources + +Use this command to create a change set for importing existing (non-IaC) resources into a CloudFormation stack. +```bash +aws cloudformation create-change-set \ + --stack-name my-stack-name \ + --change-set-name my-change-set-name \ + --change-set-type IMPORT \ + --template-body file://my-template.yaml \ + --resources-to-import file://my-import-definition.json \ + --region ap-northeast-1 +``` + + +### Check the Status of a Change Set + +Use this command to inspect the status and details of a change set. +```bash +aws cloudformation describe-change-set \ + --stack-name my-stack-name \ + --change-set-name my-change-set-name \ + --region ap-northeast-1 +``` + +### Execute a Change Set + +Use this command to execute the prepared change set. +```bash +aws cloudformation execute-change-set \ + --stack-name my-stack-name \ + --change-set-name my-change-set-name \ + --region ap-northeast-1 +```