AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: an example of cgi
Resources:
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
Subnet1:
Type: AWS::EC2::Subnet
Properties:
VpcId:
Ref: VPC
CidrBlock: 10.0.1.0/24
AvailabilityZone: !Select
- 0
- Fn::GetAZs: !Ref 'AWS::Region'
EfsSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: !Ref VPC
GroupDescription: "mnt target sg"
SecurityGroupIngress:
- IpProtocol: "-1"
CidrIp: 0.0.0.0/0
FileSystem:
Type: AWS::EFS::FileSystem
Properties:
PerformanceMode: generalPurpose
MountTarget1:
Type: AWS::EFS::MountTarget
Properties:
FileSystemId: !Ref FileSystem
SubnetId: !Ref Subnet1
SecurityGroups:
- !Ref EfsSecurityGroup
AccessPoint:
Type: AWS::EFS::AccessPoint
Properties:
FileSystemId: !Ref FileSystem
PosixUser:
Uid: "1000"
Gid: "1000"
RootDirectory:
CreationInfo:
OwnerGid: "1000"
OwnerUid: "1000"
Permissions: "0777"
Path: "/data"
LambdaSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: !Ref VPC
GroupDescription: "lambda sg"
WwwCounter:
Type: AWS::Serverless::Function
Metadata:
BuildMethod: makefile
Properties:
Description: Www Counter
CodeUri: ./WwwCounter/
Handler: handler.handle
Runtime: provided.al2
Environment:
Variables:
WWWCOUNT_DIR: /mnt/efs0
Layers:
- arn:aws:lambda:ap-northeast-1:445285296882:layer:perl-5-34-runtime-al2:2
Events:
CatchAll:
Type: HttpApi
VpcConfig:
SecurityGroupIds:
- !Ref LambdaSecurityGroup
SubnetIds:
- !Ref Subnet1
FileSystemConfigs:
- Arn: !GetAtt AccessPoint.Arn
LocalMountPath: "/mnt/efs0"