SAM template with dev, prod stacks, Dynamo DB name clash between stacks?

0

I have created a SAM stack with a CI/CD pipeline using this tutorial as a guide. https://catalog.workshops.aws/complete-aws-sam/en-US/module-4-cicd/module-4-cicd-codepipeline/50-sampipeinit

I have used sam pipeline init --bootstrap to Crete a pipeline with the ‘Two-stage pipeline’ from template.

Everything was fine.

I then added the following to my SAM template to add a dynamo DB table

  UserDataTable:
    Type: AWS::Serverless::SimpleTable
    Properties:
      TableName: UserData
      PrimaryKey:
        Name: UserID
        Type: String
      ProvisionedThroughput:
        ReadCapacityUnits: 5
        WriteCapacityUnits: 5

After this the code pipeline failed on the prod stage with the following error

UserData already exists in stack arn:aws:cloudformation:<>region>[myARN ] The following resource(s) failed to create: [UserDataTable].

So it appears that there is a name clash.

My question is this, I thought the names we give in the SAM templates are “ logical names “ which are later translated to physical names during stack creation. For example I have other resources defined as below

  MyCognitoUserPool:
    Type: AWS::Cognito::UserPool
	<Rest of the code >


  MyApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: Prod
      <Rest of the code>

These things don’t create any name clashes. Why is Dynamo DB behaving differently and how do I fix this please?

질문됨 3달 전148회 조회
1개 답변
0
수락된 답변

Just realised I shouldn't have named the table I removed the following line

TableName: UserData

And everything is OK

답변함 3달 전
profile picture
전문가
검토됨 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠