diff --git a/assets/contributors.csv b/assets/contributors.csv index 0dee5589bd..f7fc991655 100644 --- a/assets/contributors.csv +++ b/assets/contributors.csv @@ -125,3 +125,4 @@ Akash Malik,Arm,akashmalik19973,akash-malik-a65bab219,, Matt Cossins,Arm,matt-cossins,,, Sue Wu,Arm,,,, Sabika Tasneem,Memgraph,,,, +Anupras Mohapatra,Arm,,,, \ No newline at end of file diff --git a/content/install-guides/aws-cdk.md b/content/install-guides/aws-cdk.md new file mode 100644 index 0000000000..d58b11865a --- /dev/null +++ b/content/install-guides/aws-cdk.md @@ -0,0 +1,82 @@ +--- +additional_search_terms: +- cloud +- deploy +layout: installtoolsall +minutes_to_complete: 15 +author: Anupras Mohapatra +multi_install: false +multitool_install_part: false +official_docs: https://docs.aws.amazon.com/cdk/v2/guide/home.html +test_images: +- ubuntu:latest +test_maintenance: true +draft: true +title: AWS CDK CLI +description: Install the AWS CDK CLI on Arm Linux and macOS using npm, then verify the setup with the `cdk` command. +tool_install: true +weight: 1 +--- + +The AWS Cloud Development Kit (CDK) is an open-source infrastructure as code (IaC) software development framework. You can use the AWS CDK to define and deploy applications on Arm-based cloud infrastructure powered by AWS Graviton. + +With the CDK, you can write applications in a supported programming language of your choice. You can then use the AWS CDK CLI to translate the code into an AWS CloudFormation template and deploy the application. + +In this guide, you'll learn how to install the CDK CLI and verify that the CLI installation was successful. + +## Before you begin + +Make sure that you have the AWS CLI installed: + +```bash +aws --version +``` + +The output is similar to: + +```output +aws-cli/2.34.56 Python/3.14.5 Darwin/25.5.0 exe/arm64 +``` +For more information about setting up AWS credentials and installing the AWS CLI, see the [AWS Credentials](/install-guides/aws_access_keys/) and [AWS CLI](/install-guides/aws-cli/) install guides. + +Make sure you have Node.js 22 or later installed: + +```bash +node --version +``` + +The output is similar to: + +```output +v26.2.0 +``` +If you don't have Node.js installed, or if the installed version is earlier than Node.js 22, download a suitable version from the [Node.js website](https://nodejs.org/en/download). + +You'll also need to install prerequisites specific to the programming languages that you want to use. For more information about language-specific prerequisites, see [Install Node.js and programming language prerequisites](https://docs.aws.amazon.com/cdk/v2/guide/prerequisites.html#prerequisites-node) in the AWS CDK documentation. + +## Install the AWS CDK CLI + +Use `npm` to install the AWS CDK CLI: + +```bash +npm install -g aws-cdk +``` + +## Verify the installation + +After installing the AWS CDK CLI, check the version of the CLI: + +```bash +cdk --version +``` + +The output is similar to: + +```output +2.1125.0 (build 71fd29e) +``` +## Next steps + +You've now installed the AWS CDK CLI and verified that the installation was successful. + +Next, you can use the AWS CDK to create and deploy applications on Arm-based compute powered by AWS Graviton. To learn how you can use the CDK and Amazon Elastic Container Service (ECS) to run containers on Arm-based compute, see [Deploy containers on Arm-based compute using Amazon ECS and the AWS CDK](/learning-paths/servers-and-cloud-computing/aws-cdk/). diff --git a/content/learning-paths/servers-and-cloud-computing/aws-cdk/_index.md b/content/learning-paths/servers-and-cloud-computing/aws-cdk/_index.md new file mode 100644 index 0000000000..86736128e9 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/aws-cdk/_index.md @@ -0,0 +1,60 @@ +--- +title: Deploy containers on Arm-based compute using Amazon ECS and the AWS CDK +description: Learn how to define and deploy a containerized application on Arm-based compute using the AWS Cloud Development Kit. + +draft: true +cascade: + draft: true + +minutes_to_complete: 45 + +who_is_this_for: This is an introductory topic for software developers who want to use the AWS Cloud Development Kit (AWS CDK) to deploy applications on Arm-based AWS infrastructure. + +learning_objectives: + - Create an example AWS CDK application in JavaScript + - Define AWS infrastructure using the AWS CDK + - Deploy application resources on Arm-based AWS compute using Amazon ECS and the AWS CDK + +prerequisites: + - An Amazon Web Services (AWS) account + - A local computer with the AWS CLI, AWS CDK CLI, and Node.js installed + - Familiarity with the Linux command line and JavaScript + +author: Anupras Mohapatra + +### Tags +skilllevels: Introductory +subjects: Containers and Virtualization +cloud_service_providers: + - AWS +armips: + - Neoverse +operatingsystems: + - Linux +tools_software_languages: + - AWS CDK CLI + - Amazon Elastic Container Service (Amazon ECS) + - AWS CLI + - Node.js + - JavaScript + +further_reading: + - resource: + title: AWS CDK Developer Guide + link: https://docs.aws.amazon.com/cdk/v2/guide/home.html + type: documentation + - resource: + title: AWS CDK CLI install guide + link: /install-guides/aws-cdk/ + type: install-guide + - resource: + title: AWS CLI install guide + link: /install-guides/aws-cli/ + type: install-guide + +### FIXED, DO NOT MODIFY +# ================================================================================ +weight: 1 # _index.md always has weight of 1 to order correctly +layout: "learningpathall" # All files under learning paths have this same wrapper +learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content. +--- diff --git a/content/learning-paths/servers-and-cloud-computing/aws-cdk/_next-steps.md b/content/learning-paths/servers-and-cloud-computing/aws-cdk/_next-steps.md new file mode 100644 index 0000000000..c3db0de5a2 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/aws-cdk/_next-steps.md @@ -0,0 +1,8 @@ +--- +# ================================================================================ +# FIXED, DO NOT MODIFY THIS FILE +# ================================================================================ +weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation. +title: "Next Steps" # Always the same, html page title. +layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing. +--- diff --git a/content/learning-paths/servers-and-cloud-computing/aws-cdk/app.md b/content/learning-paths/servers-and-cloud-computing/aws-cdk/app.md new file mode 100644 index 0000000000..254c23be5e --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/aws-cdk/app.md @@ -0,0 +1,115 @@ +--- +title: "Create a sample AWS CDK application" +description: Create a JavaScript AWS CDK application that defines an Amazon ECS service running on Arm-based AWS Fargate compute. +weight: 2 + +layout: "learningpathall" +--- + +## Set up a sample AWS CDK application + +The AWS Cloud Development Kit (CDK) is an open-source infrastructure as code (IaC) software development framework. + +In this section, you'll create a JavaScript CDK application that defines an Amazon Elastic Container Service (ECS) service running on Arm-based AWS Fargate compute. + +Arm-based AWS compute is powered by AWS Graviton processors. For more information about AWS Graviton, see [Level up your compute with AWS Graviton](https://aws.amazon.com/ec2/graviton/level-up-with-graviton/). + +### Before you begin + +Make sure that you've installed the AWS CDK CLI: + +```bash +cdk --version +``` + +The output is similar to: + +```output +2.1125.0 (build 71fd29e) +``` + +For instructions to set up and install the AWS CDK CLI, see the [AWS CDK install guide](/install-guides/aws-cdk). + +Make sure you've installed Node.js: + +```bash +node --version +``` + +The output is similar to: +```output +v26.2.0 +``` + +### Initialize a CDK project + +Create a directory for your CDK project and navigate to it: + +```bash +mkdir arm-cdk-app +cd arm-cdk-app/ +``` + +After navigating into the project directory, initialize a JavaScript CDK project: + +```bash +cdk init --language javascript +``` + +The output is similar to: + +```output +Applying project template app for javascript +# Welcome to your CDK JavaScript project + +This is a blank project for CDK development with JavaScript. + +The `cdk.json` file tells the CDK Toolkit how to execute your app. The build step is not required when using JavaScript. + +## Useful commands + +* `npm run test` perform the jest unit tests +* `npx cdk deploy` deploy this stack to your default AWS account/region +* `npx cdk diff` compare deployed stack with current state +* `npx cdk synth` emits the synthesized CloudFormation template + +... +``` + +### Use the AWS CDK with JavaScript to define a sample application + +In the project, you'll find a file called `arm-cdk-app-stack.js` in the `lib` directory. AWS CDK uses this stack definition to deploy all necessary AWS resources. + +Update `lib/arm-cdk-app-stack.js` to define a load-balanced Amazon ECS service that runs an NGINX web server on an Arm-based AWS Fargate runtime platform: + +```javascript +const cdk = require('aws-cdk-lib'); +const ecs = require('aws-cdk-lib/aws-ecs'); +const ecsPatterns = require('aws-cdk-lib/aws-ecs-patterns'); + +class ArmCdkAppStack extends cdk.Stack { + constructor(scope, id, props) { + super(scope, id, props); + + new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Service', { + taskImageOptions: { + image: ecs.ContainerImage.fromRegistry("nginx:latest"), + containerPort: 80, + }, + runtimePlatform: { + cpuArchitecture: ecs.CpuArchitecture.ARM64, + operatingSystemFamily: ecs.OperatingSystemFamily.LINUX, + }, + publicLoadBalancer: true, + }); + } +} + +module.exports = { ArmCdkAppStack }; +``` + +## What you've accomplished and what's next + +You've now set up a sample application using AWS CDK. + +Next, you'll use AWS CDK to synthesize and deploy the application. diff --git a/content/learning-paths/servers-and-cloud-computing/aws-cdk/cdk.md b/content/learning-paths/servers-and-cloud-computing/aws-cdk/cdk.md new file mode 100644 index 0000000000..652974dd24 --- /dev/null +++ b/content/learning-paths/servers-and-cloud-computing/aws-cdk/cdk.md @@ -0,0 +1,90 @@ +--- +title: "Synthesize and deploy the sample AWS CDK application" +description: Synthesize, deploy, verify, and clean up a sample AWS CDK application running on Arm-based AWS Fargate compute. +weight: 3 + +layout: "learningpathall" +--- + +## Synthesize the AWS CDK application + +Before you can deploy an application using the AWS CDK, you need to synthesize it. During synthesis, the AWS CDK checks for errors in the application code and then translates the code into an AWS CloudFormation template. + +Within the project directory, synthesize the application: + +```bash +cdk synth +``` +You can find the generated JSON template at `cdk.out/ArmCdkAppStack.template.json`. + +## Bootstrap the AWS CDK application environment + +After synthesizing your application, you need to bootstrap the environment. In this step, the AWS CDK creates resources such as AWS Identity and Access Management (IAM) roles. + +Within the project directory, bootstrap the environment: + +```bash +cdk bootstrap +``` + +## Deploy the AWS CDK application + +After bootstrapping the environment, you're ready to deploy the application. AWS CDK deploys the application using the AWS CloudFormation stack generated during synthesis and IAM roles created during bootstrap. + +Deploy the application: + +```bash +cdk deploy +``` +By default, the AWS CDK CLI will prompt you to approve IAM-related changes during deployment. + +For the AWS CDK CLI to deploy the application without the need for approval, set the `--require-approval` flag to `never` during deployment: + +```bash +cdk deploy --require-approval never +``` + +{{% notice Note %}} +The deployment can take a couple minutes to complete. +{{% /notice %}} + +When the deployment completes, the last couple lines of the output will include a URL to the web server and the load balancer's DNS name: + +```output +Outputs: +ArmCdkAppStack.MyWebServerLoadBalancerDNSXXXXXXX = Hello-MyWeb-ZZZZZZZZZZZZZ-ZZZZZZZZZZ.us-east-1.elb.amazonaws.com +ArmCdkAppStack.MyWebServerServiceURLYYYYYYYY = http://Hello-MyWeb-ZZZZZZZZZZZZZ-ZZZZZZZZZZ.us-east-1.elb.amazonaws.com +``` + +## Verify application deployment + +Open the URL from the deployment output in a web browser of your choice. + +You'll see the following welcome message: + +![Screenshot of the application showing the NGINX welcome page and confirming the web server was deployed on Arm-based compute successfully.#center](nginx-output.png "NGINX welcome page indicating successful deployment") + +## Clean up AWS resources + +After you've validated the deployment, clean up the AWS resources that you created with AWS CDK to avoid incurring costs: + +```bash +cdk destroy +``` +By default, the AWS CDK CLI will prompt you to approve the deletion of `ArmCDKAppStack`. + +For the AWS CDK CLI to clean up resources without the need for approval, use the `--force` or `-f` flag: + +```bash +cdk destroy -f +``` + +{{% notice Note %}} +The cleanup process can take a couple minutes to complete. +{{% /notice %}} + +## What you've accomplished + +You've now synthesized and deployed a sample containerized application on Arm-based compute using Amazon ECS and the AWS CDK. After verifying that the deployment was successful, you cleaned up resources. + +You can use this workflow to programmatically deploy and manage containerized applications on Arm-based compute powered by AWS Graviton processors. diff --git a/content/learning-paths/servers-and-cloud-computing/aws-cdk/nginx-output.png b/content/learning-paths/servers-and-cloud-computing/aws-cdk/nginx-output.png new file mode 100644 index 0000000000..f3f2f158f6 Binary files /dev/null and b/content/learning-paths/servers-and-cloud-computing/aws-cdk/nginx-output.png differ