Skip to content

Commit f9950ae

Browse files
authored
SAR Tutorial Pt 1 (#8)
* [sar] initial resources for the next blog post * [git] update CODEOWNERS
1 parent cd4abc1 commit f9950ae

File tree

5 files changed

+71
-1
lines changed

5 files changed

+71
-1
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# These owners will be the default owners for everything in the repo.
2-
* @austinbyers @drixta @jacknagz @nhakmiller @kostaspap
2+
* @austinbyers @jacknagz @nhakmiller @kartikeypan

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.out/

serverless-app-repository/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# AWS Serverless Application Repository: Lambda and Beyond
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
AWSTemplateFormatVersion: 2010-09-09
2+
Description: S3 bucket for AWS Lambda source code
3+
4+
Resources:
5+
Bucket:
6+
Type: AWS::S3::Bucket
7+
Properties:
8+
BucketName: !Sub ${AWS::AccountId}-lambda-source-${AWS::Region}
9+
BucketEncryption:
10+
ServerSideEncryptionConfiguration:
11+
- ServerSideEncryptionByDefault:
12+
SSEAlgorithm: AES256
13+
PublicAccessBlockConfiguration:
14+
BlockPublicAcls: true
15+
BlockPublicPolicy: true
16+
IgnorePublicAcls: true
17+
RestrictPublicBuckets: true
18+
AccessControl: Private
19+
VersioningConfiguration:
20+
Status: Enabled
21+
22+
BucketPolicy:
23+
Type: AWS::S3::BucketPolicy
24+
Properties:
25+
Bucket: !Ref Bucket
26+
PolicyDocument:
27+
Statement:
28+
- Sid: AllowServerlessRepoToGetSourceCode
29+
Action: s3:GetObject
30+
Effect: Allow
31+
Resource: !Sub ${Bucket.Arn}/*
32+
Principal:
33+
Service: serverlessrepo.amazonaws.com
34+
35+
Outputs:
36+
BucketName:
37+
Description: The name of the S3 Bucket.
38+
Value: !Ref Bucket
39+
Export:
40+
Name: !Sub ${AWS::StackName}-BucketName
41+
BucketArn:
42+
Description: The Arn of the S3 Bucket.
43+
Value: !GetAtt Bucket.Arn
44+
Export:
45+
Name: !Sub ${AWS::StackName}-BucketArn
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
AWSTemplateFormatVersion: 2010-09-09
2+
Transform: AWS::Serverless-2016-10-31
3+
Description: A Sample Hello-World SAR Application
4+
5+
Resources:
6+
Function:
7+
Type: AWS::Serverless::Function
8+
Properties:
9+
FunctionName: sample-application
10+
Description: A sample SAR application
11+
Handler: index.main
12+
InlineCode: |
13+
import os
14+
15+
def main(event, context):
16+
name = os.getenv('NAME', event.get('name', 'world'))
17+
print('Hello, {}!'.format(name))
18+
Runtime: python3.7
19+
MemorySize: 128
20+
Timeout: 10
21+
Environment:
22+
Variables:
23+
NAME: Panther

0 commit comments

Comments
 (0)