简体   繁体   中英

Trouble creating DynamoDB on AWS Elastic Beanstalk with Python

I'm trying to deploy my Python Flask application to Elastic Beanstalk and create a DynamoDB table and SQS Queue in the config file. I've set up my config file (similar to https://github.com/awslabs/eb-py-flask-signup/blob/master/.ebextensions/setup.config ) like this:

Resources:
  EmailsTable:
    Type: AWS::DynamoDB::Table
    Properties:
      KeySchema:
        HashKeyElement:
          AttributeName: "email"
          AttributeType: "S"
        ProvisionedThroughput:
          ReadCapacityUnits: 1
          WriteCapacityUnits: 1
  NewBatchQueue:
    Type: "AWS::SQS::Queue"

files:
  "/var/app/app.config":
    mode: "000444"
    owner: "apache"
    group: "apache"
    content: |
      AWS_REGION = '`{ "Ref" : "AWS::Region"}`'
      EMAIL_TABLE = '`{ "Ref" : "EmailsTable"}`'

option_settings:
  "aws:elasticbeanstalk:application:environment":
    "APP_CONFIG": "/var/app/app.config"

I've set my default role policy to accept DynamoDB (ie by allowing dynamodb:"*" ), but when I push using git aws.push I get the following error on my AWS console: Service:AmazonCloudFormation, Message:Stack named 'awseb-e-79sqgmxq6p-stack' aborted operation. Current state: 'UPDATE_ROLLBACK_IN_PROGRESS' Reason: The following resource(s) failed to create: [EmailsTable]. Service:AmazonCloudFormation, Message:Stack named 'awseb-e-79sqgmxq6p-stack' aborted operation. Current state: 'UPDATE_ROLLBACK_IN_PROGRESS' Reason: The following resource(s) failed to create: [EmailsTable].

Any thoughts as to why this could be happening?

Nevermind, turns out I had an indentation error. The lines

ProvisionedThroughput:
  ReadCapacityUnits: 1
  WriteCapacityUnits: 1

should have been indented one out

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM