1. Answers
  2. Deploying AWS Amplify with Shield Protection

How do I deploy AWS Amplify with Shield protection?

In this guide, we will deploy an AWS Amplify application and protect it using AWS Shield. AWS Amplify makes it easy to create, configure, and deploy scalable web and mobile applications. AWS Shield provides protection against Distributed Denial of Service (DDoS) attacks. We will use Pulumi to manage the infrastructure as code.

Key Points

  • Define an AWS Amplify application.
  • Enable AWS Shield protection for the Amplify app.
  • Use Pulumi to manage and deploy the infrastructure.
import * as aws from "@pulumi/aws";

// Define an AWS Amplify application
const amplifyApp = new aws.amplify.App("myAmplifyApp", {
    name: "myAmplifyApp",
    repository: "https://github.com/your-repo/your-app",
    platform: "WEB",
    buildSpec: `version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm install
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*`,
});

// Enable AWS Shield protection for the Amplify app
const shieldProtection = new aws.shield.Protection("myAmplifyShieldProtection", {
    name: amplifyApp.name,
    resourceArn: amplifyApp.arn,
});

// Export the Amplify app URL
export const amplifyAppUrl = amplifyApp.defaultDomain;

Summary

In this guide, we deployed an AWS Amplify application and protected it using AWS Shield. The Amplify app was defined with a repository and build specifications. AWS Shield protection was enabled for the Amplify app to safeguard against DDoS attacks. Pulumi was used to manage and deploy the infrastructure.

Deploy this code

Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.

Sign up

New to Pulumi?

Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.

Sign up