Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

[Bug] Erro ao executar cdk bootstrap e cdk deploy Vpc

## daniel@MacBook-Pro-de-Daniel alura-aws-infra % cdk bootstrap
 ⏳  Bootstrapping environment aws://450707262861/us-east-1...
Trusted accounts for deployment: (none)
Trusted accounts for lookup: (none)
Using default execution policy of 'arn:aws:iam::aws:policy/AdministratorAccess'. Pass '--cloudformation-execution-policies' to customize.
CDKToolkit: creating CloudFormation changeset...
[████████████████████████▏·································] (5/12)
[████████████████████████▏·································] (5/12)
13:26:54 | CREATE_FAILED        | AWS::IAM::Role          | CloudFormationExecutionRole
cdk-hnb659fds-cfn-exec-role-450707262861-us-east-1 already exists

 ❌  Environment aws://450707262861/us-east-1 failed bootstrapping: Error: The stack named CDKToolkit failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: cdk-hnb659fds-cfn-exec-role-450707262861-us-east-1 already exists
    at FullCloudFormationDeployment.monitorDeployment (/Users/daniel/.npm-global/lib/node_modules/aws-cdk/lib/index.js:397:10236)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/daniel/.npm-global/lib/node_modules/aws-cdk/lib/index.js:402:2104
    at async Promise.all (index 0)
    at async CdkToolkit.bootstrap (/Users/daniel/.npm-global/lib/node_modules/aws-cdk/lib/index.js:402:1949)
    at async exec4 (/Users/daniel/.npm-global/lib/node_modules/aws-cdk/lib/index.js:455:51984)

The stack named CDKToolkit failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: cdk-hnb659fds-cfn-exec-role-450707262861-us-east-1 already exists
daniel@MacBook-Pro-de-Daniel alura-aws-infra % 
daniel@MacBook-Pro-de-Daniel alura-aws-infra % 
daniel@MacBook-Pro-de-Daniel alura-aws-infra % **cdk deploy Vpc**

✨  Synthesis time: 12.78s

Vpc: building assets...

current credentials could not be used to assume 'arn:aws:iam::450707262861:role/cdk-hnb659fds-deploy-role-450707262861-us-east-1', but are for the right account. Proceeding anyway.

 ❌ Building assets failed: Error: Building Assets Failed: Error: Vpc: SSM parameter /cdk-bootstrap/hnb659fds/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
    at buildAllStackAssets (/Users/daniel/.npm-global/lib/node_modules/aws-cdk/lib/index.js:400:115268)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async CdkToolkit.deploy (/Users/daniel/.npm-global/lib/node_modules/aws-cdk/lib/index.js:400:143766)
    at async exec4 (/Users/daniel/.npm-global/lib/node_modules/aws-cdk/lib/index.js:455:51984)

Building Assets Failed: Error: Vpc: SSM parameter /cdk-bootstrap/hnb659fds/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
1 resposta
solução!

Olá, Daniel! Tudo bem?

Pelo que entendi, você está tentando executar o comando cdk deploy Vpc e está recebendo um erro informando que o SSM parameter /cdk-bootstrap/hnb659fds/version não foi encontrado, certo?

Esse erro ocorre porque o ambiente não foi inicializado corretamente. Para resolver esse problema, você precisa executar o comando cdk bootstrap novamente.

No entanto, antes de executar o comando, é necessário excluir o stack cdk-hnb659fds-cfn-exec-role-450707262861-us-east-1 manualmente da console da AWS. Depois, execute o comando cdk bootstrap novamente e, em seguida, execute o comando cdk deploy Vpc.

Caso o erro persista, verifique se você tem as permissões necessárias para executar as operações desejadas.

Espero ter ajudado e bons estudos!