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

167
Visualizações
AWS CDK vs AWS Amplify

I have a doubt in my mind regarding AWS Amplify and CDK. In Amplify if we can create new environments and publish them to their respective buckets? Why do we need CDK? Any use case that would make CDK a better fit?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

CDK let you deploy (quite) any type of Stack that you have to manually do with cloudformation. Using cdk, you are going to create a CloudFormation stack more quicly and in a more secure way.

An example in JAVA, in order to create a new Table, you can use the following code instead of deal with YAML configuration:

 private Table CreateMasterDataTable(String TABLE_NAME) {
    return Table.Builder.create(this, TABLE_NAME + "_MasterDataTable")
            .tableName(TABLE_NAME.concat("_gvr-bic-masterdata"))
            .partitionKey(Attribute.builder().type(AttributeType.STRING).name("siteId").build())
            .removalPolicy(RemovalPolicy.RETAIN)
            .stream(StreamViewType.NEW_AND_OLD_IMAGES)
            .readCapacity(5)
            .writeCapacity(5)
            .build();
}

In order to create a new Lambda (provided an alredy existent JAR), you can use the following code instead of deal with YAML configuration:

private Function CreateSiteAggregationNowFunction() {
    Map<String, String> env = new HashMap<>();
    env.put(Constants.LAMBDA_KEY_ENV, API_NAME);
    return Function.Builder.create(this, API_NAME + "_SiteAggregationNow")
            .code(Code.fromAsset(Constants.LAMBDA_PATH_SITE_NOW))
            .handler("it.fabricalab.gvr.bic.DeviceLoader::handleRequest")
            .timeout(Duration.seconds(30))
            .environment(env)
            .functionName(API_NAME.concat("_SiteAggregationNow"))
            .runtime(Runtime.JAVA_8)
            .retryAttempts(Constants.LAMBDA_RETRY_FALLBACK)
            .memorySize(512)
            .build();
}

Than, in order to create the policy for let the lambda read from the table:

final Table masterDataTable = CreateMasterDataTable(API_NAME);
final Function siteAggregationNow = CreateSiteAggregationNowFunction();

masterDataTable .grantReadData(siteAggregationNow);

With these few lines, you have crated a CloudFormation stack with a DynamoDB table (that use stream) and a Lambda that read from this table.

over 4 years ago · Santiago Trujillo Relatório

0

Amplify is ok for deploying static sites, with a simple database and Cognito integration, but it is not good for managing a large number of environments or more complicated stacks. CDK is much better for managing complex infrastructure deployment. This is an example of how you can deploy static sites with CDK. https://github.com/davidsteed/awscdkstaticsite. It improves on what can be done with Amplify by dealing with security headers and certificate generation.

over 4 years ago · Santiago Trujillo Relatório

0

You will find out that you will need to write and edit a lot of CloudFormation templates for a production app. That gets very painful very fast.

Amplify should emit CDK code, that would give us the best of both worlds.

I used Amplify a lot initially as it could bootstrap you quickly, but since discovering CDK, CDK is the tool I use the most.

over 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