目次
- 初心者から実務者向けの包括的解説
- 概要
- SAR が解決する課題
- 主な特徴
- アーキテクチャ
- コアコンポーネント
- AWS SAM テンプレート
- Application 公開・バージョン管理
- Public / Private Applications
- Application デプロイメント
- CloudFormation との統合
- CDK との統合
- 主要ユースケース
- CLI・SDK・IaC による操作例
- Popular Applications・ベストセラー
- Organization-wide SAR Policy
- セキュリティ・Compliance
- 類似サービス比較
- ベストプラクティス
- トラブルシューティング表
- 2025-2026 最新動向
- 学習リソース
- 実装例・チェックリスト
- まとめ
AWS Serverless Application Repository(SAR)v2.0 完全ガイド
初心者から実務者向けの包括的解説
AWS Serverless Application Repository(SAR) は、AWS SAM(Serverless Application Model)テンプレートベースのサーバーレスアプリケーションの発見・公開・デプロイ・共有を実現するマネージドマーケットプレイスです。Lambda・API Gateway・DynamoDB・SNS などのサーバーレスコンポーネントを組み合わせたアプリケーションを、組織内で再利用したり、AWS コミュニティと公開共有できます。本ガイドは、SAR の概念・アーキテクチャ・アプリケーション発行・デプロイメント・実装パターンを体系的に解説します。
ドキュメントの目的
本ガイドは以下を対象としています。
- 初心者向け:SAR とは何か、何が解決できるかを学びたい方
- 開発者向け:AWS SAM で アプリケーション開発・公開・バージョン管理をしたい方
- Platform Team 向け:社内の共通 Lambda Pattern を SAR で標準化・共有したい方
- アーキテクト向け:CloudFormation・CDK・Terraform との使い分け・ガバナンス
- 意思決定者向け:SAR vs OSS package registry(Helm・npm)の投資判断
2025-2026 年の SAR エコシステム
- AWS SAM CLI 拡張:ローカル開発・テスト・デバッグの改善
- CDK Integration:CDK から SAR アプリケーションへの直接参照
- Verified Publisher Program:セキュリティ・ライセンス検証済みパブリッシャーバッジ
- Application Versioning:セマンティックバージョニング管理の強化
- Organization-wide Policy:AWS Organizations を通じた企業ガバナンス
- EventBridge Integration:Event-driven Serverless パターンの標準化
- Observability:X-Ray・CloudWatch・Application Insights との統合強化
目次
- 概要
- SAR が解決する課題
- 主な特徴
- アーキテクチャ
- コアコンポーネント
- AWS SAM テンプレート
- Application 公開・バージョン管理
- Public / Private Applications
- Application デプロイメント
- CloudFormation との統合
- CDK との統合
- 主要ユースケース(12+)
- CLI・SDK・IaC による操作例
- Popular Applications・ベストセラー
- Organization-wide SAR Policy
- セキュリティ・Compliance
- 類似サービス比較(Helm Charts・Terraform Registry・Crossplane)
- ベストプラクティス
- トラブルシューティング表
- 2025-2026 最新動向
- 学習リソース
- 実装例・チェックリスト
- まとめ
- 参考文献
概要
初心者向けメモ:SAR は「サーバーレスアプリケーション版の App Store」です。Lambda 関数・API Gateway・DynamoDB などを組み合わせた完全なサーバーレスアプリケーション(例:Slack ボット、画像処理パイプライン、認証ミドルウェア)を AWS SAM テンプレートで定義し、SAR に公開できます。他のチーム・個人が「ワンクリックでデプロイ」できるため、アプリケーションの再利用性を大幅に向上させます。SAR 自体は無料で、デプロイされるリソース(Lambda・DynamoDB など)のコストのみが発生します。
SAR の位置づけ:
graph TD
Dev["開発者<br/>SAM テンプレート作成"]
SAR["AWS SAR<br/>Application Repository"]
Dev -->|publish| SAR
SAR -->|public| Community["コミュニティ<br/>AWS サービス"]
SAR -->|private| Org["組織内<br/>チーム共有"]
Community -->|deploy| App["Application<br/>Lambda + API GW + DB"]
Org -->|deploy| App
SAR が解決する課題
課題 1: サーバーレスアプリケーションの再利用性低下
状況:各チームが独立して Lambda・API Gateway・DynamoDB を構成。Slack 通知・データ検証・認証など共通パターンが重複実装される。アップデート時に全チームで個別修正が必要。
SAR による解決:
- 共通パターンを SAR で 1 度だけ実装・公開
- 全チームが同じバージョンを利用
- バージョンアップ時に全 Application が自動update
- アプリケーション間の一貫性を確保
課題 2: AWS Lambda のベストプラクティスの標準化
状況:Lambda ロギング・エラーハンドリング・VPC 設定など、開発者によって実装レベルが異なる。
SAR による解決:
- AWS Lambda Powertools など検証済みユーティリティを SAR で公開
- 全開発者が同じパターンを採用
- セキュリティ・パフォーマンス監査がしやすい
課題 3: 新規プロジェクトの起動時間短縮
状況:新しい Slack Integration・画像処理パイプライン・Web API を 1 から構築するのに 2 週間要する。
SAR による解決:
- SAR から関連 Application を 5 分でデプロイ
- テンプレートをカスタマイズして本番運用
- 開発時間を 80% 削減
課題 4: マルチアカウント・マルチ Organization でのコンポーネント共有
状況:複数の AWS アカウント・Organization を運用。共通の認証・監視・ログ集約機能を全 Account で利用したい。
SAR による解決:
- Private Application で AWS Organizations に共有
- 各 Account が同じ SAR アプリケーションを デプロイ
- 一元管理・バージョン制御が可能
主な特徴
| 特徴 | 説明 |
|---|---|
| テンプレートベース | AWS SAM で定義・バージョン管理・再利用 |
| ワンクリックデプロイ | AWS Console / CLI / CDK で数クリックで deploy |
| バージョン管理 | セマンティックバージョニング(1.0.0 / 1.1.0 等) |
| Public / Private | コミュニティ共有 / 組織内非公開を選択可能 |
| CloudFormation 統合 | ネストされた CloudFormation スタックとしてデプロイ |
| パラメータカスタマイズ | デプロイ時にアプリケーション設定を上書き可能 |
| SAR 検索 | キーワード・カテゴリー・Publisher で検索 |
| AWS Lambda Powertools 対応 | 公式ユーティリティライブラリを Layer として再利用 |
| Event-driven Serverless | EventBridge・S3 Event・API Gateway と統合 |
| Cost-efficient | SAR 自体は無料(デプロイ後のリソース料金のみ) |
アーキテクチャ
┌──────────────────────────────────────────┐
│ Publisher(開発者) │
│ SAM template.yaml │
│ Lambda functions │
│ README / License │
└──────────────────────────────────────────┘
↓
aws serverlessrepo create-application
↓
┌──────────────────────────────────────────┐
│ AWS Serverless Application Repository │
│ ├─ Public Applications(全ユーザー利用) │
│ └─ Private Applications(組織内利用) │
└──────────────────────────────────────────┘
↓
AWS Console / CLI / CDK
↓
┌──────────────────────────────────────────┐
│ Consumer(利用者) │
│ ├─ Application parameters 入力 │
│ ├─ IAM capability 確認 │
│ └─ CloudFormation stack deploy │
└──────────────────────────────────────────┘
↓
┌──────────────────────────────────────────┐
│ Deployed Resources │
│ ├─ Lambda Function │
│ ├─ API Gateway │
│ ├─ DynamoDB Table │
│ └─ IAM Roles / Policies │
└──────────────────────────────────────────┘
コアコンポーネント
1. Application(アプリケーション)
SAR に公開されるサーバーレスアプリケーションの単位。
Application Properties:
├─ Name:アプリケーション名
├─ SemanticVersion:バージョン(1.0.0)
├─ Author:開発者
├─ Description:説明
├─ License:ライセンス(MIT / Apache-2.0 等)
├─ SourceCodeUrl:GitHub URL
├─ HomePageUrl:公式サイト
├─ Labels:タグ(python, sqs, s3 等)
└─ ReadmeUrl / LicenseUrl:ドキュメント
2. Version(バージョン)
Application は複数のバージョンを持つ。各バージョンは独立した SAM テンプレートで定義。
Version Management:
├─ 1.0.0:初期リリース
├─ 1.1.0:新機能追加(backward compatible)
├─ 1.2.0:バグ修正
├─ 2.0.0:Breaking changes
└─ Latest:最新バージョンへの自動 upgrade
3. Semantic Versioning
SAR は セマンティックバージョニング(SemVer)に準拠。
MAJOR.MINOR.PATCH
↓ ↓ ↓
2.0.0 Breaking change
1.1.0 New features(backward compatible)
1.0.1 Bug fixes
4. Public Application(公開アプリケーション)
AWS コミュニティ全体で利用可能。Lambda Console から検索・デプロイ。
5. Private Application(非公開アプリケーション)
組織内・特定 AWS Account のみで利用可能。AWS Organizations を通じて共有。
AWS SAM テンプレート
SAM Template 基本構造
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
# アプリケーション メタデータ
Metadata:
AWS::ServerlessRepo::Application:
Name: my-serverless-app
Description: A serverless application example
Author: My Company
SpdxLicenseId: MIT
LicenseUrl: LICENSE.txt
ReadmeUrl: README.md
HomePageUrl: https://github.com/myorg/my-app
SemanticVersion: 1.0.0
SourceCodeUrl: https://github.com/myorg/my-app
Labels:
- python
- lambda
- api
- serverless
# パラメータ(ユーザーが デプロイ時に入力)
Parameters:
TableName:
Type: String
Default: MyDynamoDBTable
Description: DynamoDB table name
# グローバル設定
Globals:
Function:
Runtime: python3.12
Timeout: 30
Environment:
Variables:
TABLE_NAME: !Ref TableName
# リソース定義
Resources:
# Lambda Function
MyFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: python3.12
CodeUri: src/
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref TableName
Environment:
Variables:
TABLE_NAME: !Ref TableName
Events:
ApiEvent:
Type: Api
Properties:
Path: /items
Method: GET
RestApiId: !Ref ApiGateway
# API Gateway
ApiGateway:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
Cors:
AllowMethods: "'GET,POST,PUT,DELETE'"
AllowHeaders: "'Content-Type'"
# DynamoDB Table
MyTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: !Ref TableName
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
# 出力(ユーザーが利用するエンドポイント等)
Outputs:
ApiEndpoint:
Description: API Gateway endpoint
Value: !Sub 'https://${ApiGateway}.execute-api.${AWS::Region}.amazonaws.com/Prod'
FunctionArn:
Description: Lambda function ARN
Value: !GetAtt MyFunction.Arn
TableName:
Description: DynamoDB table name
Value: !Ref MyTable
Lambda Powertools の SAR での利用
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: python3.12
CodeUri: src/
Layers:
# AWS Lambda Powertools を Layer として参照
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:XXX
Environment:
Variables:
POWERTOOLS_SERVICE_NAME: my-service
POWERTOOLS_LOG_LEVEL: INFO
Application 公開・バージョン管理
SAR Application 作成
# 1. SAM テンプレートを準備
cat > template.yaml << 'EOF'
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Metadata:
AWS::ServerlessRepo::Application:
Name: image-thumbnail-generator
Description: Automatically generate thumbnails from S3 uploads
Author: My Company
SpdxLicenseId: MIT
SemanticVersion: 1.0.0
SourceCodeUrl: https://github.com/myorg/thumbnail-generator
Parameters:
SourceBucket:
Type: String
Description: S3 bucket for original images
Resources:
ThumbnailFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: python3.12
CodeUri: src/
Policies:
- S3ReadPolicy:
BucketName: !Ref SourceBucket
- S3WritePolicy:
BucketName: !Sub '${SourceBucket}-thumbnails'
Events:
S3Event:
Type: S3
Properties:
Bucket: !Ref SourceBucket
Events: s3:ObjectCreated:*
Outputs:
FunctionArn:
Value: !GetAtt ThumbnailFunction.Arn
EOF
# 2. SAR に Application を 公開
aws serverlessrepo create-application \
--name image-thumbnail-generator \
--description "Automatically generate thumbnails from S3 uploads" \
--author "My Company" \
--spdx-license-id MIT \
--license-body file://LICENSE.txt \
--home-page-url https://github.com/myorg/thumbnail-generator \
--source-code-url https://github.com/myorg/thumbnail-generator \
--semantic-version 1.0.0 \
--template-body file://template.yaml \
--region us-east-1
# 3. Application ID を取得
APP_ID=$(aws serverlessrepo list-applications \
--query "Applications[?Name=='image-thumbnail-generator'].ApplicationId" \
--output text)
echo "Application ID: $APP_ID"
新バージョン公開
# バージョン 1.1.0 を公開(新機能追加)
aws serverlessrepo create-application-version \
--application-id $APP_ID \
--semantic-version 1.1.0 \
--template-body file://template-v1.1.0.yaml
# バージョン 2.0.0 を公開(Breaking changes)
aws serverlessrepo create-application-version \
--application-id $APP_ID \
--semantic-version 2.0.0 \
--template-body file://template-v2.0.0.yaml
Public / Private Applications
Public Application(コミュニティ共有)
# Application を Public に設定
aws serverlessrepo put-application-policy \
--application-id $APP_ID \
--statements '[{"Actions": ["Deploy"], "Principals": "*"}]'
# AWS Lambda Console から検索可能に
# → 全ユーザーがデプロイ可能
Private Application(組織内共有)
# Organizations 内の特定 OU のみに共有
aws serverlessrepo put-application-policy \
--application-id $APP_ID \
--statements '[
{
"Actions": ["Deploy"],
"Principals": ["arn:aws:iam::123456789013:root"],
"PrincipalOrgIDs": ["o-xxxxxxxxxx"]
}
]'
# または特定 AWS Account のみに共有
aws serverlessrepo put-application-policy \
--application-id $APP_ID \
--statements '[
{
"Actions": ["Deploy"],
"Principals": ["123456789013", "123456789014"]
}
]'
Application デプロイメント
AWS Console でのデプロイ
- Lambda Console → Applications → Browse applications
- Application を検索・選択
- Parameters を入力(Table Name など)
- Deploy
AWS CLI でのデプロイ
# Change Set 作成(デプロイ前に差分確認)
aws serverlessrepo create-cloud-formation-change-set \
--application-id $APP_ID \
--semantic-version 1.0.0 \
--stack-name my-thumbnail-app \
--parameter-overrides \
ParameterKey=SourceBucket,ParameterValue=my-bucket \
--capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND \
--region us-east-1
# Change Set を実行(Stack Deploy)
aws cloudformation execute-change-set \
--change-set-name arn:aws:cloudformation:us-east-1:123456789012:changeSet/...
AWS CDK でのデプロイ
from aws_cdk import (
aws_sam as sam,
core,
)
class MyStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs):
super().__init__(scope, id, **kwargs)
# SAR Application をデプロイ
app = sam.CfnApplication(
self, 'ThumbnailGenerator',
location=sam.CfnApplication.ApplicationLocationProperty(
application_id='arn:aws:serverlessrepo:us-east-1:123456789012:applications/image-thumbnail-generator',
semantic_version='1.0.0',
),
parameters={
'SourceBucket': 'my-source-bucket',
}
)
CloudFormation との統合
Nested Stack として デプロイ
# CloudFormation template
AWSTemplateFormatVersion: '2010-09-09'
Resources:
ThumbnailGeneratorStack:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: !Sub
- 'https://${AWS::Region}-serverlessrepo-catalogs.s3.${AWS::Region}.amazonaws.com/applications/image-thumbnail-generator-cf0dd4a7-...'
- AWS::Region: !Ref 'AWS::Region'
Parameters:
SourceBucket: my-bucket
TimeoutInMinutes: 10
Capabilities:
- CAPABILITY_IAM
- CAPABILITY_AUTO_EXPAND
Outputs:
FunctionArn:
Value: !GetAtt ThumbnailGeneratorStack.Outputs.FunctionArn
CDK との統合
CDK から SAR Application を参照
from aws_cdk import (
aws_sam as sam,
aws_lambda as lambda_,
core,
)
class MyStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs):
super().__init__(scope, id, **kwargs)
# SAR Application をデプロイ
powertools_app = sam.CfnApplication(
self, 'PowerToolsApp',
location=sam.CfnApplication.ApplicationLocationProperty(
application_id='arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-extras',
semantic_version='2.35.0',
),
parameters={
'LambdaLayerName': 'powertools-layer',
}
)
# 出力された Layer ARN を取得
layer_arn = core.Fn.get_att(powertools_app, 'Outputs.LayerVersionArn').to_string()
# Custom Lambda が Layer を利用
my_function = lambda_.Function(
self, 'MyFunction',
runtime=lambda_.Runtime.PYTHON_3_12,
handler='index.handler',
code=lambda_.Code.from_asset('src/'),
layers=[
lambda_.LayerVersion.from_layer_version_arn(
self, 'PowerToolsLayer',
layer_arn,
)
],
)
主要ユースケース
1. Lambda Powertools Layer の共有
Development Team A → SAR に PowerTools Layer 発行
↓
All Teams → SAR から デプロイ
↓
統一された logging / tracing / metrics
2. 共通認証ミドルウェア
Organization Level
├─ Cognito User Pool
├─ Custom Authorizer Lambda
└─ SAR で発行 → 全アプリが同じ認証を利用
3. S3 イベント処理パイプライン
SAR Application: S3 → Lambda → SQS → DynamoDB
├─ Parameter: Input Bucket
├─ Parameter: Output Format
└─ Parameter: Retention Days
各チーム: デプロイ時にパラメータをカスタマイズ
4. データ検証・品質チェック
SAR: Data Quality Checker Lambda
├─ Input: S3 path
├─ Logic: Schema validation / Null checks
└─ Output: Pass / Fail + CloudWatch Logs
全 Data Pipeline が同じ validation logic を適用
5. CloudWatch Logs → Slack 通知
SAR Application
├─ CloudWatch Logs Subscription Filter
├─ Lambda (Parse + Format logs)
└─ Slack Webhook (Post notification)
Parameters: Slack URL / Channel / Severity Level
6. 定期実行ジョブ(EventBridge + Lambda)
SAR: Scheduled Batch Job
├─ EventBridge Trigger (schedule expression)
├─ Lambda (batch process)
└─ S3 output
Parameters: Schedule / Input dataset / Processing logic
7. API Layer(API Gateway + Lambda)
SAR: REST API Template
├─ API Gateway + Authorizer
├─ Lambda (business logic)
└─ DynamoDB (persistence)
Organizations: DB table / API stage を共有化
8. Multi-Tenant Data Isolation
SAR: Tenant-aware Lambda
├─ Cognito から tenant_id 抽出
├─ DynamoDB に tenant_id でパーティション
└─ Logs / Metrics を tenant ごとに分離
9. Database Migration Helper
SAR: RDS → Aurora migration tool
├─ Source RDS endpoint
├─ Target Aurora endpoint
├─ Schema validation
└─ Data consistency check
10. Cost Optimization Recommender
SAR: AWS Cost Explorer → Lambda → Slack
├─ CostExplorer API を定期実行
├─ 無駄な EC2 / RDS を検出
└─ Savings recommendations を送信
11. CI/CD Automation Helper
SAR: CodePipeline Trigger Lambda
├─ Manual approval を自動化
├─ Compliance check を実行
└─ Deployment gates を管理
12. Security Audit Automation
SAR: AWS Config Rules + SNS
├─ Security Group violation check
├─ S3 bucket public access check
└─ Remediation Lambda を自動トリガー
CLI・SDK・IaC による操作例
AWS CLI
# 1. Application を検索
aws serverlessrepo list-applications \
--region us-east-1 \
--query "Applications[?contains(Labels, 'python')]"
# 2. Application 詳細を確認
aws serverlessrepo get-application \
--application-id arn:aws:serverlessrepo:us-east-1:...:applications/my-app
# 3. Application を公開
aws serverlessrepo create-application \
--name my-app \
--author "My Company" \
--semantic-version 1.0.0 \
--template-body file://template.yaml \
--region us-east-1
# 4. Application バージョンをアップロード
aws serverlessrepo create-application-version \
--application-id arn:aws:serverlessrepo:us-east-1:...:applications/my-app \
--semantic-version 1.1.0 \
--template-body file://template-v1.1.0.yaml
# 5. Private Application として 組織に共有
aws serverlessrepo put-application-policy \
--application-id arn:aws:serverlessrepo:us-east-1:...:applications/my-app \
--statements '[{"Actions": ["Deploy"], "PrincipalOrgIDs": ["o-xxxxxxxxxx"]}]'
boto3 SDK
import boto3
import json
sar = boto3.client('serverlessrepo', region_name='us-east-1')
# Application を作成
response = sar.create_application(
Name='my-thumbnail-app',
Author='My Company',
Description='Thumbnail generator from S3 events',
SpdxLicenseId='MIT',
SemanticVersion='1.0.0',
SourceCodeUrl='https://github.com/myorg/thumbnail-app',
TemplatBody=open('template.yaml').read(),
)
app_id = response['ApplicationId']
print(f"Created application: {app_id}")
# 新バージョンを公開
sar.create_application_version(
ApplicationId=app_id,
SemanticVersion='1.1.0',
TemplateBody=open('template-v1.1.0.yaml').read(),
)
# 組織内に共有
sar.put_application_policy(
ApplicationId=app_id,
Statements=[
{
'Actions': ['Deploy'],
'PrincipalOrgIDs': ['o-xxxxxxxxxx'],
}
],
)
Terraform
# SAR Application を Terraform で deploy
resource "aws_cloudformation_stack" "sar_app" {
name = "my-thumbnail-app"
template_url = "https://serverlessrepo-catalogs.s3.amazonaws.com/applications/image-thumbnail-generator-cf0dd4a7-.../template-v1.0.0.yaml"
parameters = {
SourceBucket = aws_s3_bucket.source.id
}
capabilities = ["CAPABILITY_IAM", "CAPABILITY_AUTO_EXPAND"]
on_failure = "DELETE"
}
output "function_arn" {
value = aws_cloudformation_stack.sar_app.outputs.FunctionArn
}
CDK (TypeScript)
import * as sam from 'aws-cdk-lib/aws-sam';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import { Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
export class MyStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
// SAR Application をデプロイ
const thumbnailApp = new sam.CfnApplication(this, 'ThumbnailApp', {
location: {
applicationId: 'arn:aws:serverlessrepo:us-east-1:123456789012:applications/image-thumbnail-generator',
semanticVersion: '1.0.0',
},
parameters: {
SourceBucket: 'my-source-bucket',
},
});
// 出力 Function ARN を取得
const functionArn = sam.Fn.getAtt(thumbnailApp, 'Outputs.FunctionArn').toString();
console.log(`Deployed function: ${functionArn}`);
}
}
Popular Applications・ベストセラー
| Application | 説明 | Downloads |
|---|---|---|
| aws-lambda-powertools-python-layer | ロギング・トレーシング・メトリクス Layer | 10,000+ |
| serverless-image-handler | S3 画像リサイズ(CloudFront + Lambda) | 5,000+ |
| amazon-kinesis-data-generator | Kinesis テストデータ生成 | 3,000+ |
| hello-world-lambda | Hello World サンプル | 8,000+ |
| cloudformation-compliance-checker | CloudFormation コンプライアンスチェック | 1,000+ |
| todo-backend-api | REST API テンプレート | 2,000+ |
Organization-wide SAR Policy
Central IT が共通 Applications を公開
# Central AWS Account で Application を公開
aws serverlessrepo create-application \
--name organization-auth-layer \
--description "Organization-wide custom authorizer Lambda Layer" \
--author "Central IT Team" \
--semantic-version 1.0.0 \
--template-body file://auth-layer.yaml
# 組織全体に共有ポリシーを設定
aws serverlessrepo put-application-policy \
--application-id arn:aws:serverlessrepo:us-east-1:111111111111:applications/organization-auth-layer \
--statements '[
{
"Actions": ["Deploy"],
"PrincipalOrgIDs": ["o-xxxxxxxxxx"]
}
]'
各 Account / Team で Application をデプロイ
# 各 Account で auth layer を deploy
aws serverlessrepo create-cloud-formation-change-set \
--application-id arn:aws:serverlessrepo:us-east-1:111111111111:applications/organization-auth-layer \
--semantic-version 1.0.0 \
--stack-name organization-auth-layer \
--capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND
# Change set を execute
aws cloudformation execute-change-set \
--change-set-name arn:aws:cloudformation:us-east-1:222222222222:changeSet/...
セキュリティ・Compliance
Application セキュリティチェックリスト
- [ ] IAM Policy は最小権限( Least Privilege)
- [ ] Secrets(API Key・Password)は Secrets Manager で管理
- [ ] CloudTrail で全操作をログ
- [ ] Lambda で VPC を有効化(NAT Gateway 経由)
- [ ] X-Ray トレーシング を有効化
- [ ] CloudWatch Logs 暗号化
- [ ] Input validation を実装
- [ ] Error handling で sensitive info を leak しない
Application License・Compliance
Metadata:
AWS::ServerlessRepo::Application:
Name: my-app
SpdxLicenseId: MIT # MIT / Apache-2.0 / GPL-3.0 等
LicenseUrl: https://github.com/myorg/my-app/blob/main/LICENSE
ReadmeUrl: https://github.com/myorg/my-app/blob/main/README.md
HomePageUrl: https://mycompany.com
SourceCodeUrl: https://github.com/myorg/my-app
類似サービス比較
| 観点 | SAR | Helm Charts | Terraform Registry | Crossplane Compositions |
|---|---|---|---|---|
| 対象 | AWS Serverless | Kubernetes | IaC Templates | Cloud Infrastructure |
| パッケージ形式 | SAM Template | Helm Charts | Terraform Modules | XRD / Composition |
| 実行環境 | AWS Lambda / API GW | Kubernetes | Terraform | Crossplane Operator |
| 配布 | SAR Marketplace | Helm Repository | Terraform Registry | OCI Registry |
| バージョン管理 | SemanticVer | Semantic Ver | Semantic Ver | Semantic Ver |
| Public / Private | Both | Both | Both | Both |
| CI/CD 統合 | CloudFormation | Helm / GitOps | Terraform / TFC | GitOps / ArgoCD |
| 学習曲線 | 中(SAM知識) | 中(YAML) | 中(Terraform) | 高(CRD) |
ベストプラクティス
推奨事項(✅)
- ✅ SemanticVer で バージョンを厳密に管理
- ✅ README / License を テンプレートに含める
- ✅ Parameters で カスタマイズ可能に設計
- ✅ IAM Policy を最小権限で定義
- ✅ CloudWatch Logs / X-Ray を有効化
- ✅ Unit tests・Integration tests を実施
- ✅ Private Application で 組織内共有を活用
- ✅ AWS SAM CLI で ローカルテスト実施
- ✅ README で デプロイ手順・トラブルシューティングを記述
- ✅ Breaking changes は MAJOR version で公開
アンチパターン(❌)
- ❌ Hard-coded secrets をテンプレートに埋め込む
- ❌ Application を version管理なしで頻繁に修正
- ❌ IAM Role に AdministratorAccess を付与
- ❌ ドキュメント不足で公開
- ❌ Breaking changes を MINOR version で導入
- ❌ Public で プライベート Application を公開
- ❌ テストなしで本番公開
トラブルシューティング表
| 症状 | 原因 | 解決方法 |
|---|---|---|
| “Template is invalid” エラー | SAM syntax エラー | sam validate --template template.yaml で確認 |
| Deploy が Failed | IAM 権限不足 / パラメータ誤り | CloudFormation イベント確認 / Parameters 再確認 |
| Application が見つからない | Region 誤り / Application ID 誤り | aws serverlessrepo list-applications --region us-east-1 で確認 |
| Private Application が deploy できない | 組織外の Account から実行 | Organizations ID / 共有ポリシーを確認 |
| Lambda が動作しない | Runtime / Handler 誤り | CloudWatch Logs で Function logs を確認 |
| DynamoDB テーブルが Not Found | テーブル名のパラメータ誤り | Outputs で実際に作成されたテーブル名を確認 |
2025-2026 最新動向
- Verified Publisher Program:セキュリティ・ライセンス検証済みパブリッシャーバッジ
- Application Versioning 強化:自動バージョン互換性チェック
- CloudFormation / CDK 統合強化:複雑な Application composition をサポート
- Observability Dashboard:デプロイ数・利用統計を可視化
- Organization-wide Governance:中央 IT による Application 管理・監査
- Serverless Patterns Library:AWS が提供する 50+ reference architecture
- Cost Analyzer Integration:Application ごとのコスト可視化
学習リソース
公式リソース
AWS ベンダーリソース
実装例・チェックリスト
SAR Application 開発チェックリスト
- [ ] AWS SAM テンプレートを作成
- [ ] Parameters でカスタマイズ可能に設計
- [ ] IAM Role を最小権限で定義
- [ ] README を作成(デプロイ手順・パラメータ説明)
- [ ] LICENSE ファイルを追加
- [ ] sam build / sam local invoke でテスト
- [ ] Unit tests・Integration tests を実行
- [ ] SAR に Application を公開
- [ ] Public / Private を選択
- [ ] AWS Console / CLI / CDK でデプロイテスト
- [ ] CloudWatch Logs でアプリケーションログを確認
- [ ] バージョン管理・Release notes を記述
まとめ
AWS Serverless Application Repository(SAR)は 「サーバーレスアプリケーション版の App Store」 で、AWS SAM テンプレートで定義したアプリケーションを公開・共有・デプロイできます。Lambda・API Gateway・DynamoDB などを組み合わせた完全なサーバーレスソリューションを、数クリックで展開でき、組織内での再利用性を大幅に向上させます。バージョン管理・Parameters によるカスタマイズ・Private Application による社内共有により、エンタープライズグレードのサーバーレスコンポーネント管理を実現できます。
最終更新:2026-04-27 バージョン:v2.0