Listing Thumbnail

    Confined Coding Agent Host with EC2 Metadata Blocking on Ubuntu 24.04

     Info
    Deployed on AWS
    AWS Free Tier
    This product has charges associated with it for integration of OpenCode v2.2.6 with a dedicated unprivileged user, whole-process systemd limits, EC2 metadata blocking, an optional password-protected TLS web server, a 23-check verifier, and a tested Ubuntu 24.04 baseline on t3.medium.

    Overview

    This product provides the OpenCode v2.2.6 coding agent on Ubuntu 24.04 (x86_64) with seller-written software that sets up the operating-system boundary that OpenCode itself does not provide. OpenCode's security policy states that it does not sandbox the agent and recommends a container or a virtual machine for isolation. On an EC2 instance the agent is usually run as the login user; measured with this AMI's own probe script, such an agent has sudo, can read the login user's home directory (where SSH keys and configuration normally live) and can reach the EC2 metadata service. This AMI keeps the OpenCode binary unmodified and changes the setup around it. The additional charges cover seller-performed integration, configuration and testing on the bounded baseline described below. Any support or maintenance offered by the seller is a supplementary service and is not the sole basis for the software charges.

    What the additional charges cover:

    • A dedicated system user, opencode, with no password, a nologin shell, no sudo, and a deny entry in the sshd configuration. The OpenCode binary is root:opencode with mode 0750, so a normal login cannot start it unconfined; the only entry point is sudo hanwei-opencode.
    • Whole-process limits applied by systemd to every session and to the optional web server: no capabilities, no privilege gain, a read-only system, hidden /home and /root, private temp and device directories, hidden foreign processes, and restricted socket families. In a test where a scripted stub model drove the agent through this runner, the agent saw 6 processes instead of 125, could not write outside /var/lib/opencode, could not use sudo and could not read the login user's home.
    • Blocking of the EC2 instance metadata service for the agent, so a prompt-injected agent cannot request the instance role's credentials. A command allows access when you choose to, and a live probe in the verifier checks that the running limits match the chosen policy.
    • Nothing listens on the network except SSH until you run one command to turn on an optional web server: OpenCode's server on the loopback address with a per-instance random password, behind nginx with a self-signed TLS certificate that is re-checked on every start and follows the instance's public IP. A second command turns it off.
    • A first-boot initializer that creates a fresh state directory, a random server password and a certificate on each instance; no session, credential or key is in the image.
    • A command that hides OpenCode's free hosted models, by setting an upstream environment variable for the sessions and the server.
    • A verifier with 23 checks across operating system settings, the OpenCode installation and licence files, including live probes run with the same limits, with a JSON report. It runs hourly and reports drift; it does not revert changes.
    • Testing of the above on the stated baseline.

    Technical implementation:

    • Confinement directives are stored in systemd drop-ins that the hanwei-opencode command also reads, so sessions and the web server cannot diverge. If the drop-ins are missing the command refuses to run.
    • Every session uses a private OpenCode server (the standalone mode); the shared background service, serve, pair and upgrade commands are refused by the runner.
    • sshd is configured for public-key login only; kernel and network settings are applied through sysctl.

    Included components:

    • Ubuntu 24.04.5 LTS (x86_64)
    • OpenCode v2.2.6 (MIT licence), unmodified release binary
    • git 2.43.0, ripgrep 14.1.0, jq 1.7, nginx 1.24.0
    • Hanwei OpenCode Guard 1.0.0 (seller software)

    Highlights

    • 1. OpenCode runs as a dedicated unprivileged user inside systemd limits: no capabilities, no sudo, a read-only system, hidden /home and /root, hidden foreign processes. A normal login cannot start the binary without them.
    • 2. By default the agent cannot reach the EC2 instance metadata service, so it cannot request the instance role's credentials. One command allows access when you need an instance role.
    • 3. Only SSH listens until you turn on the optional password-protected TLS web server. A 23-check verifier with live probes reports drift. Tested on t3.medium with a stub model; real providers and the browser interface were not tested.

    Details

    Delivery method

    Delivery option
    64-bit (x86) Amazon Machine Image (AMI)

    Latest version

    Operating system
    Ubuntu 24.04

    Deployed on AWS

    Features and programs

    Financing for AWS Marketplace purchases

    AWS Marketplace now accepts line of credit payments through the PNC Vendor Finance program. This program is available to select AWS customers in the US, excluding NV, NC, ND, TN, & VT.
    Financing for AWS Marketplace purchases

    Pricing

    Confined Coding Agent Host with EC2 Metadata Blocking on Ubuntu 24.04

     Info
    Pricing is based on actual usage, with charges varying according to how much you consume. Subscriptions have no end date and may be canceled any time. Alternatively, you can pay upfront for a contract, which typically covers your anticipated usage for the contract duration. Any usage beyond contract will incur additional usage-based costs.
    Additional AWS infrastructure costs may apply. Use the AWS Pricing Calculator  to estimate your infrastructure costs.
    If you are an AWS Free Tier customer with a free plan, you are eligible to subscribe to this offer. You can use free credits to cover the cost of eligible AWS infrastructure. See AWS Free Tier  for more details. If you created an AWS account before July 15th, 2025, and qualify for the Legacy AWS Free Tier, Amazon EC2 charges for Micro instances are free for up to 750 hours per month. See Legacy AWS Free Tier  for more details.

    Usage costs (33)

     Info
    Dimension
    Cost/hour
    t3.medium
    Recommended
    $0.05
    t3.micro
    $0.05
    t2.micro
    $0.05
    t3.large
    $0.05
    t3.nano
    $0.05
    t3.small
    $0.05
    t3a.large
    $0.05
    t3a.medium
    $0.05
    t3a.micro
    $0.05
    t3a.nano
    $0.05

    Vendor refund policy

    No refund

    Custom pricing options

    Request a private offer to receive a custom quote.

    How can we make this page better?

    Tell us how we can improve this page, or report an issue with this product.
    Tell us how we can improve this page, or report an issue with this product.

    Legal

    Vendor terms and conditions

    Upon subscribing to this product, you must acknowledge and agree to the terms and conditions outlined in the vendor's End User License Agreement (EULA) .

    Content disclaimer

    Vendors are responsible for their product descriptions and other product content. AWS does not warrant that vendors' product descriptions or other product content are accurate, complete, reliable, current, or error-free.

    Usage information

     Info

    Delivery details

    64-bit (x86) Amazon Machine Image (AMI)

    Amazon Machine Image (AMI)

    An AMI is a virtual image that provides the information required to launch an instance. Amazon EC2 (Elastic Compute Cloud) instances are virtual servers on which you can run your applications and workloads, offering varying combinations of CPU, memory, storage, and networking resources. You can launch as many instances from as many different AMIs as you need.

    Version release notes

    Version v2.2.6 (Guard 1.0.0) - Initial Release (2026-11-10)

    This release provides the OpenCode v2.2.6 coding agent on Ubuntu 24.04 with the agent running as a dedicated unprivileged user inside operating-system limits, the EC2 instance metadata service blocked for the agent, and nothing listening on the network except SSH until you turn on an optional web server. It includes the seller-provided Hanwei OpenCode Guard 1.0.0. The configuration was tested on a t3.medium instance.

    Seller-provided technical value:

    • A command, hanwei-opencode, that starts OpenCode sessions as the system user opencode in a systemd unit with no capabilities, no privilege gain, a read-only system, hidden /home and /root, private temp and device directories, hidden foreign processes and restricted socket families. The optional web server runs under exactly the same limits.
    • The OpenCode binary is readable and executable only by root and the service user, so a normal login cannot start it without these limits. The usual alternative, running the agent as the login user, gives it sudo, read access to the login user's home directory (where SSH keys and configuration normally live) and the instance role's credentials.
    • Blocking of the EC2 instance metadata service for the agent, with a command to allow it when you choose to. A live probe in the verifier checks that the running limits match the chosen policy.
    • An optional web server that you turn on with one command: OpenCode's server on the loopback address with a per-instance random password, behind nginx with a self-signed TLS certificate that follows the instance's public IP. One command turns it off again.
    • A first-boot initializer that creates a fresh state directory, a random server password and a certificate on each instance.
    • A command to hide OpenCode's free hosted models (it sets OPENCODE_DISABLE_FREE_MODELS).
    • A verifier with 23 checks, including live probes run with the same limits, with a JSON report. It runs hourly and reports drift; it does not revert changes.

    Included software:

    • Ubuntu 24.04.5 LTS (x86_64)
    • OpenCode v2.2.6 (commit dc2ffcf8bf26), unmodified release binary (MIT licence)
    • git 2.43.0, ripgrep 14.1.0, jq 1.7, nginx 1.24.0
    • Hanwei OpenCode Guard 1.0.0

    Not included:

    • A language model, a model provider account, GPU drivers, compilers and language runtimes. You connect your own provider inside OpenCode.

    Tested baseline:

    • Architecture: x86_64. Instance type: t3.medium (2 vCPU, 4 GiB), 40 GiB gp3.
    • Verification: two instances launched from this AMI were checked for first boot, the 23-check verifier, a port scan from another instance, differences in generated secrets, what the agent can and cannot do when a scripted stub model drives it through the confined runner, the metadata switch, the optional web server (password check, TLS, password rotation, reboot persistence, change of public IP after stop and start), and detection of deliberately introduced misconfigurations. No real model provider was used.

    Customer responsibilities and limitations:

    • OpenCode itself has no sandbox, as its security policy states. The limits protect the operating system and the instance credentials from the agent. They do not stop it from using files in its workspace, credentials you give it or outbound internet access, and they do not prevent prompt injection. Keep OpenCode's permission prompts on.
    • OpenCode offers free hosted models (provider id opencode). On a fresh instance without any provider, 12 such models were listed. If you pick one, your prompts and the files the agent reads go to OpenCode's hosted service under its terms. This AMI leaves that upstream default on; the command above hides them.
    • OpenCode may contact opencode.ai and models.dev (model catalog, update check). The full set of outbound connections was not captured.
    • Real model providers (including Amazon Bedrock with an instance role while metadata is blocked), the browser interface and its terminal feature, MCP servers, plugins, skills, other instance types, performance, backups and upgrades were not tested.
    • The OpenCode binary is a single compiled file that does not carry the notices of its bundled dependencies and cannot be scanned for a software bill of materials; an approximate list of direct dependencies is included.
    • The certificate of the optional web server is self-signed. Open TCP 443 only from your own address range.
    • OpenCode is a separate open-source project. "OpenCode" and its logo are trademarks of Anomaly. The seller is not affiliated with it.

    Additional details

    Usage instructions

    Launch with your own EC2 key pair, a root volume of at least 40 GiB, and a Security Group that allows TCP 22 from your own address range. Nothing else needs to be open unless you turn on the web server.

    SSH to the instance as ubuntu using the key pair selected at launch.

    Verify the delivered configuration:

    • sudo hanwei-opencode-guard verify (23 checks; exit code 0 when all required checks pass)

    Start a confined session:

    • sudo hanwei-opencode starts the OpenCode interface in /var/lib/opencode/workspace. Use /connect inside it to add a model provider. One-shot: sudo hanwei-opencode run "your task".
    • Run every OpenCode command through sudo hanwei-opencode; it is the only way that applies the limits.

    EC2 metadata (blocked by default):

    • sudo hanwei-opencode-guard netpolicy imds allow lets the agent request the instance role's credentials; give the role minimum permissions. netpolicy imds block restores the default.

    Free hosted models (offered by OpenCode by default):

    • sudo hanwei-opencode-guard freemodels off hides them; freemodels on restores the default.

    Optional web server (off by default):

    • sudo hanwei-opencode-guard web enable prints the address, the user name opencode and the generated password. Open TCP 443 only for the addresses that need it. The certificate is self-signed. web rotate-password replaces the password; web disable turns the server off.

    Security boundary:

    • The limits protect the operating system and the instance credentials from the agent. Keep OpenCode's permission prompts on, put only the files you want it to touch in the workspace, and back up your data. Apply Ubuntu updates with sudo apt update && sudo apt upgrade. Documentation is at /usr/share/doc/hanwei-opencode/.

    Support

    Vendor support

    For product technical support, please contact prosupport@hanweie.com 

    AWS infrastructure support

    AWS Support is a one-on-one, fast-response support channel that is staffed 24x7x365 with experienced and technical support engineers. The service helps customers of all sizes and technical abilities to successfully utilize the products and features provided by Amazon Web Services.

    Similar products

    Customer reviews

    Ratings and reviews

     Info
    0 ratings
    5 star
    4 star
    3 star
    2 star
    1 star
    0%
    0%
    0%
    0%
    0%
    0 reviews
    No customer reviews yet
    Be the first to review this product . We've partnered with PeerSpot to gather customer feedback. You can share your experience by writing or recording a review, or scheduling a call with a PeerSpot analyst.