examples icon indicating copy to clipboard operation
examples copied to clipboard

Update WebServer examples to use Amazon Linux 2023 AMI

Open Copilot opened this issue 6 months ago • 4 comments

This PR updates the WebServer examples that were previously using the Amazon Linux 2 AMI (which has been retired by AWS) to the newer Amazon Linux 2023 AMI.

Changes made:

  • Updated aws-js-webserver/index.js to use al2023-ami-*-x86_64 filter with owner 137112412989
  • Updated aws-js-webserver-component/webserver.js to use al2023-ami-*-x86_64 filter with owner 137112412989
  • Updated aws-py-webserver/__main__.py to use al2023-ami-*-x86_64 filter with owner 137112412989
  • Updated aws-java-webserver/src/main/java/webserver/App.java to use al2023-ami-*-x86_64 filter instead of the specific version

The C#, Go, and TypeScript examples were already using the correct Amazon Linux 2023 AMI, so no changes were needed for those.

Fixes #2179.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar May 20 '25 13:05 Copilot

Are you sure this is correct? I've never heard of the al2023 AMI.

Yes, this is correct. Amazon Linux 2023 (AL2023) is the successor to Amazon Linux 2, which has been retired by AWS. The "al2023-ami--x86_64" filter pattern is the appropriate one to use for Amazon Linux 2023 AMIs, while the previous Amazon Linux 2 used "amzn-ami-hvm-".

You can verify this in the AWS documentation: https://docs.aws.amazon.com/linux/al2023/ug/what-is-amazon-linux.html

The owner ID "137112412989" remains the same for both Amazon Linux versions as they are both official AWS AMIs.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aws.amazon.com
    • Triggering command: curl -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot avatar May 20 '25 18:05 Copilot

Ok, add a test to verify this.

joeduffy avatar May 20 '25 18:05 joeduffy

Ok, add a test to verify this.

I've added tests to verify the Amazon Linux 2023 AMI configuration across all examples:

  1. TypeScript test in testing-unit-ts/mocha/ec2_ami_test.ts
  2. Python test in testing-unit-py/test_amazon_linux_ami.py
  3. Java test in aws-java-webserver/src/test/java/webserver/AmiFilterTest.java

All tests confirm that the examples are correctly using the filter pattern al2023-ami-*-x86_64 and the owner ID 137112412989. Commit: d184c1a

Copilot avatar May 20 '25 18:05 Copilot

@claude can you run 4.0 in the action yet?

rshade avatar May 23 '25 17:05 rshade