This package is a core plugin for the AWS Amplify Command Line Interface (CLI), specifically designed to manage the hosting services for Amplify projects. It empowers developers to seamlessly add, update, push, and remove web hosting capabilities, primarily leveraging services like AWS Amplify Console (for full-stack deployments) or Amazon S3/CloudFront (for static site hosting). While the overall Amplify CLI is in its `v14.x` major version, this specific plugin (`amplify-category-hosting`) is at version `3.4.10`, indicating a stable and less frequently updated internal component. The Amplify CLI generally follows a frequent release cadence, often weekly or bi-weekly, for bug fixes and minor improvements across its various categories. Its key differentiator is deeply integrating hosting with other Amplify backend categories (Auth, API, Storage) and providing a streamlined CI/CD pipeline for frontend web applications, simplifying the deployment process for developers.
npm install amplify-category-hostingVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing an Amplify project, adding Amplify Console hosting for manual deployment, building the frontend, and publishing it to the cloud. It also shows how to remove the hosting category.
Update Node.js to version 18 or higher in your local development environment and in your Amplify Console build settings. Configure the `runtime` in your build specification if necessary.
Always use the Amplify CLI or Amplify Studio to manage resources provisioned by Amplify. If drift occurs, a `amplify status` and `amplify push --force` might sometimes resolve it, but it's best to avoid manual changes. For complex cases, consider rolling back or recreating the environment.
Regularly run `amplify pull --force` in each environment to synchronize local configurations with the backend. For CI/CD, ensure environment variables or IAM roles provide appropriate permissions to deploy to the target Amplify App ID and environment. Verify `platform` type in Amplify Hosting settings is correct for SSR (WEB_COMPUTE/WEB_DYNAMIC) vs static (WEB) apps.
Check the build logs in the Amplify Console for specific error messages. Ensure your Node.js version is consistent (e.g., set `NVM_VERSION` environment variable). Increase the build compute type (Standard to Large) or build timeout in the Amplify Console. Optimize build artifacts to stay within size limits for SSR Lambda functions (e.g., remove dev dependencies from deployment package).
Using the Amplify CLI, deploy the application specifically in the failing account/environment. Get the App ID from a working environment (e.g., 'dev') and then run `amplify pull --appId <APP_ID> --envName <FAILING_ENV_NAME>` followed by `amplify publish` or `amplify push` in the context of the failing environment.
Avoid manual changes to Amplify-generated resources. If drift occurs, `amplify status` might indicate discrepancies. In some cases, `amplify push --force` may help synchronize, but for complex drift, manual intervention to revert changes in the AWS Console to match the CloudFormation template or even recreating the resource might be necessary as a last resort.
Reduce the size of your deployment artifact. This often involves ensuring that development dependencies are not bundled into the production build, using external modules provided by the Lambda runtime where possible, or excluding large unnecessary files from the deployment package.
In the Amplify Console, navigate to 'App settings' -> 'Build settings'. Increase the 'Build compute type' from 'Standard' to 'Large' to provide more memory. Also, increase the 'Build timeout' setting to 60 or 120 minutes.