sandboxについて
npm ampx sandbox
amplify/backend.ts ファイルを追加して以下のようにします。
import { defineBackend } from "@aws-amplify/backend"; defineBackend({});
これで npm ampx sandbox コマンドを実行すると、サンドボックスが起動します。
サンドボックスを実行すると、CloudFormationに以下のようなスタックが追加されます。
amplify-amplifygen2-xxxxx-sandbox-12345abcde
また、amplify_outputs.json が作成されます。 今回はまだAWSのリソースを作成していないので、バージョン番号のみです。
{ "version": "1.3" }
例
例
$ npx ampx sandbox [Sandbox] Pattern !.vscode/extensions.json found in .gitignore. ".vscode/extensions.json" will not be watched if other patterns in .gitignore are excluding it. Amplify Sandbox Identifier: xxxxx Stack: amplify-amplifygen2-xxxxx-sandbox-123456abcd Region: ap-northeast-1 To specify a different sandbox identifier, use --identifier ✨ Synthesis time: 0.02s ⚠️ The --hotswap and --hotswap-fallback flags deliberately introduce CloudFormation drift to speed up deployments ⚠️ They should only be used for development - never use them for your production Stacks! amplify-amplifygen2-xxxxx-sandbox-123456abcd: start: Building amplify-amplifygen2-xxxxx-sandbox-123456abcd Template amplify-amplifygen2-xxxxx-sandbox-123456abcd: success: Built amplify-amplifygen2-xxxxx-sandbox-123456abcd Template amplify-amplifygen2-xxxxx-sandbox-123456abcd: start: Publishing amplify-amplifygen2-xxxxx-sandbox-123456abcd Template (current_account-current_region) amplify-amplifygen2-xxxxx-sandbox-123456abcd: success: Published amplify-amplifygen2-xxxxx-sandbox-123456abcd Template (current_account-current_region) amplify-amplifygen2-xxxxx-sandbox-123456abcd: deploying... [1/1] ⚠️ The following non-hotswappable changes were found: output: deploymentType, reason: output was changed output: region, reason: output was changed resource: CDKMetadata, type: AWS::CDK::Metadata, reason: resource 'CDKMetadata' was created by this deployment ✨ hotswap-deployment time: 0.14s Could not perform a hotswap deployment, as the stack amplify-amplifygen2-xxxxx-sandbox-123456abcd contains non-Asset changes Falling back to doing a full deployment amplify-amplifygen2-xxxxx-sandbox-123456abcd: creating stack... amplify-amplifygen2-xxxxx-sandbox-123456abcd | 0 | 10:48:21 PM | CREATE_IN_PROGRESS | AWS::CDK::Metadata | CDKMetadata/Default (CDKMetadata) amplify-amplifygen2-xxxxx-sandbox-123456abcd | 0 | 10:48:22 PM | CREATE_IN_PROGRESS | AWS::CDK::Metadata | CDKMetadata/Default (CDKMetadata) Resource creation Initiated amplify-amplifygen2-xxxxx-sandbox-123456abcd | 1 | 10:48:22 PM | CREATE_COMPLETE | AWS::CDK::Metadata | CDKMetadata/Default (CDKMetadata) amplify-amplifygen2-xxxxx-sandbox-123456abcd | 2 | 10:48:24 PM | CREATE_COMPLETE | AWS::CloudFormation::Stack | amplify-amplifygen2-xxxxx-sandbox-123456abcd ✅ amplify-amplifygen2-xxxxx-sandbox-123456abcd ✨ Deployment time: 11.24s Outputs: amplify-amplifygen2-xxxxx-sandbox-123456abcd.deploymentType = sandbox amplify-amplifygen2-xxxxx-sandbox-123456abcd.region = ap-northeast-1 Stack ARN: arn:aws:cloudformation:ap-northeast-1:123456789012:stack/amplify-amplifygen2-xxxxx-sandbox-123456abcd/1234abcd-5678-90ab-cdef-12345abcdef ✨ Total time: 11.26s [Sandbox] Watching for file changes... File written: amplify_outputs.jsonx