0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

AWS CDK S3パケット作成でハマった事

0
Posted at

環境 ubuntu20.04

Node.js 16.13

勉強のためAWS CDKを使ってデプロイするまで、まだまだ時間がかかる。
初めてS3パケット作成するまでをメモします。

pip install -r requirements.txtを実行したら以下のエラーが発生


Collecting aws-cdk-lib==2.2.0
Downloading aws_cdk_lib-2.2.0-py3-none-any.whl (57.6 MB)
|████████████████████████████████| 57.6 MB 3.4 MB/s
Collecting constructs<11.0.0,>=10.0.0
Using cached constructs-10.0.12-py3-none-any.whl (54 kB)
Requirement already satisfied: jsii<2.0.0,>=1.47.0 in /home/saito/.local/lib/python3.8/site-packages (from aws-cdk-lib==2.2.0->-r requirements.txt (line 1)) (1.49.0)
Requirement already satisfied: publication>=0.0.3 in /home/saito/.local/lib/python3.8/site-packages (from aws-cdk-lib==2.2.0->-r requirements.txt (line 1)) (0.0.3)
Requirement already satisfied: attrs~=21.2 in /home/saito/.local/lib/python3.8/site-packages (from jsii<2.0.0,>=1.47.0->aws-cdk-lib==2.2.0->-r requirements.txt (line 1)) (21.2.0)
Requirement already satisfied: python-dateutil in /usr/lib/python3/dist-packages (from jsii<2.0.0,>=1.47.0->aws-cdk-lib==2.2.0->-r requirements.txt (line 1)) (2.7.3)
Requirement already satisfied: cattrs~=1.8.0; python_version >= "3.7" in /home/saito/.local/lib/python3.8/site-packages (from jsii<2.0.0,>=1.47.0->aws-cdk-lib==2.2.0->-r requirements.txt (line 1)) (1.8.0)
Requirement already satisfied: typing-extensions<5.0,>=3.7 in /home/saito/.local/lib/python3.8/site-packages (from jsii<2.0.0,>=1.47.0->aws-cdk-lib==2.2.0->-r requirements.txt (line 1)) (3.10.0.2)
ERROR: aws-cdk-aws-logs 1.135.0 has requirement constructs<4.0.0,>=3.3.69, but you'll have constructs 10.0.12 which is incompatible.
ERROR: aws-cdk-aws-events 1.135.0 has requirement constructs<4.0.0,>=3.3.69, but you'll have constructs 10.0.12 which is incompatible.
ERROR: aws-cdk-assets 1.135.0 has requirement constructs<4.0.0,>=3.3.69, but you'll have constructs 10.0.12 which is incompatible.
ERROR: aws-cdk-aws-iam 1.135.0 has requirement constructs<4.0.0,>=3.3.69, but you'll have constructs 10.0.12 which is incompatible.
ERROR: aws-cdk-aws-ssm 1.135.0 has requirement constructs<4.0.0,>=3.3.69, but you'll have constructs 10.0.12 which is incompatible.
ERROR: aws-cdk-core 1.135.0 has requirement constructs<4.0.0,>=3.3.69, but you'll have constructs 10.0.12 which is incompatible.
ERROR: aws-cdk-aws-cloudwatch 1.135.0 has requirement constructs<4.0.0,>=3.3.69, but you'll have constructs 10.0.12 which is incompatible.
ERROR: aws-cdk-aws-s3-assets 1.135.0 has requirement constructs<4.0.0,>=3.3.69, but you'll have constructs 10.0.12 which is incompatible.
ERROR: aws-cdk-aws-s3 1.135.0 has requirement constructs<4.0.0,>=3.3.69, but you'll have constructs 10.0.12 which is incompatible.
ERROR: aws-cdk-aws-kms 1.135.0 has requirement constructs<4.0.0,>=3.3.69, but you'll have constructs 10.0.12 which is incompatible.
ERROR: aws-cdk-aws-ec2 1.135.0 has requirement constructs<4.0.0,>=3.3.69, but you'll have constructs 10.0.12 which is incompatible.
Installing collected packages: constructs, aws-cdk-lib
Attempting uninstall: constructs
Found existing installation: constructs 3.3.166
Uninstalling constructs-3.3.166:
Successfully uninstalled constructs-3.3.166
Attempting uninstall: aws-cdk-lib
Found existing installation: aws-cdk-lib 2.1.0
Uninstalling aws-cdk-lib-2.1.0:
Successfully uninstalled aws-cdk-lib-2.1.0
Successfully installed aws-cdk-lib-2.2.0 constructs-10.0.12

調べたら
以下の情報を入手
[Troubleshooting common AWS CDK issues](https://docs.aws.amazon.com/cdk/latest/guide/troubleshooting.html)
依存関係が原因のようなので、記述に随い

pip install --upgrade -r requirements.txt

最後に以下のコマンドを実行

pip install -r requirements.txt

上手くいったと思ったら、
次のエラー

T430s:~/StaticSite$ cdk bootstrap 
Unable to resolve AWS account to use. It must be either configured when you define your CDK Stack, or through the environment

aws congureにAWSの情報が入っていない。
いろいろいじってAWS CLIの情報を削除してしまった。
再度、




aws configure
AWS Access Key ID [None]:アクセスキー
AWS Secret Access Key [None]: シークレットアクセスキー
Default region name [None]: リージョン名
Default output format [None]:json


cdk bootstrapを実行しました


````
cdk bootstrap
⏳  Bootstrapping environment aws://386764058501/ap-northeast-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...




 ✅  Environment aws://386764058501/ap-northeast-1 bootstrapped

````
正常にS3パケット作成されたようなので、AWSにアクセスして確認。


 
![feafedeae.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/928107/bf075e2f-8369-37a5-066b-faa868646124.jpeg)


作成されていました。



0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?