Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

266
Visualizações
S3 size limit on ApiGateway created by CloudFormation

I have a cloud formation template that defines a new api gateway:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: API for getting planetary info
Resources:
  PlanetsApi:
    Type: AWS::ApiGateway::RestApi
    Properties:
      Name: "Planets API"

I have CodePipeline set up to create this as a change set and then execute the change set.

When the change set executes, it fails with the following error:

13:55:28 UTC-0400   CREATE_FAILED   AWS::ApiGateway::RestApi PlanetsApi S3 object size exceeds limit of 2 MB

I don't know where this limit is coming from, or why anything is being uploaded to S3. Google searches are turning up no useful information. Curiously, if I create the change set and execute through the CloudFormation console, I don't get any errors.

What am I doing wrong?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Had the same problem. And wow, I realized when I use aws cloudformation package, it creates a BodyS3Location with its properties (Bucket and key) under where I define my Type: AWS::ApiGateway::RestApi. This happens, even though I had not defined such parameters earlier in my template, before being processed by cloudformation package. This, then causes the error.

What I did to tackle this issue:

  1. Let the CodePipeline to run, and fail (with the error)

  2. Go to the AWS Console, find the failed stack, and expand Template

  3. Find the lines in which BodyS3Location and its parameters are generated (for me they were in lines 22 to 24)

  4. Add a command in buildspec.yml to delete these lines, after the package command (example below)

    • aws cloudformation package --s3-bucket some-s3bucket --template-file ./template.yml --output-template-file ./packaged-template.yml

    • sed --in-place '22,24d' packaged-template.yml

  5. commit and push to repo again

  6. It must work now!

Note: This is not the best solution, this issue must be solved, from AWS end!


UPDATE:

It is something to do with the AWS CLI version. Try installing this version before running the cloudformation package command (in your CodeBuild), and you should be good to go.

pip install awscli==1.11.37
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda