AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Dynamic DNS Provider
Resources:
  PostFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.post
      Runtime: python3.6
      CodeUri: ./src
      Policies: AmazonDynamoDBFullAccess
      Events:
        Api:
          Type: Api
          Properties:
            Path: /subdomain/{subdomain}
            Method: POST
      Environment:
        Variables:
          TABLE_NAME: !Ref Table
          ZONE_ID: !Ref Zone
  PutFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.put
      Runtime: python3.6
      CodeUri: ./src
      Policies: AmazonDynamoDBReadOnlyAccess
      Events:
        Api:
          Type: Api
          Properties:
            Path: /subdomain/{subdomain}
            Method: PUT
      Environment:
        Variables:
          TABLE_NAME: !Ref Table
          ZONE_ID: !Ref Zone
  Table:
    Type: AWS::Serverless::SimpleTable
  Zone:
    Type: AWS::Route53::HostedZone
    Properties:
      Name: "ibidns.com."

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Dynamic DNS Provider
Resources:
  PostFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.post
      Runtime: python3.6
      CodeUri: ./src
      Policies: AmazonDynamoDBFullAccess
      Events:
        Api:
          Type: Api
          Properties:
            Path: /subdomain/{subdomain}
            Method: POST
      Environment:
        Variables:
          TABLE_NAME: !Ref Table
          ZONE_ID: !Ref Zone
  PutFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.put
      Runtime: python3.6
      CodeUri: ./src
      Policies:
        - AmazonDynamoDBReadOnlyAccess
        - AmazonRoute53FullAccess
      Events:
        Api:
          Type: Api
          Properties:
            Path: /subdomain/{subdomain}
            Method: PUT
      Environment:
        Variables:
          TABLE_NAME: !Ref Table
          ZONE_ID: !Ref Zone
  Table:
    Type: AWS::Serverless::SimpleTable
  Zone:
    Type: AWS::Route53::HostedZone
    Properties:
      Name: "ibidns.com."

Add Route53 permissions to PUT function
Add Route53 permissions to PUT function
