Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

168
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda