æ¬è¨äºã¯
åå¤ã®AWSã¢ã¯ã¼ãã¨ã³ã¸ãã¢ç¥ã
4æ¥ç®ã®è¨äºã§ãã
ð¦
3æ¥ç®
â¶â¶ æ¬è¨äº â¶â¶
5æ¥ç®
ð»
ããã«ã¡ã¯ï¼æè¿ãæ¯åãããè¨ããã¸ã¼ããããªããã¼ãã好ãããã¦ã大人ãããããªãããã£ã¦è¨ã£ã¦ã¦ããã¤ãã¤ãã¦ãå¿æ°´ã§ãã
ä»å¹´ããåãã¦AWS Ambassadorsã¨ãã¦é¸åºé ãã¾ãããä»ã®Ambassadorã®æ¹ãè¦ã¦ããã¨ã¾ã ã¾ã åä¸è¶³ã§ãããæ´ã«ä»åéä»»ãããä½ã
æ¨ããã«ã¯å
¨ãåã³ã¾ãããããããã³ã ã¯ä½ã
æ¨ããã»ä¸éããã ããããªãããã¨ããã®ãèªåãªãã«é å¼µã£ã¦è¨¼æãã¦ããããã¨æãã¾ãããã®ä¸æ©ã¨ãã¦åã®å¤§å¥½ããªCDKã¨ChatGPTã«é¢ãã話ããããã¨æãã¾ãã
ã¯ããã«
以åCDK Importã®è¨äºãå
¬éãã¦ããäºé±éãçµããªããã¡ã«CDK v2.20.0ã§cdk importã³ãã³ãããã¬ãã¥ã¼çã¨ãã¦ãªãªã¼ã¹ããã¾ãããã¡ãã£ã¨å¼ãã¾ããã
以åã®è¨äºã¯CloudFormation resource importsãå©ç¨ãã¦CDKã³ã¼ãã«åãè¾¼ãæ¹æ³ãç´¹ä»ãã¾ããããv2.20.0以éã¯cdk importã³ãã³ããå©ç¨ãã¦åãè¾¼ããã¨ãå¯è½ã«ãªãã¾ããããã®ãããCFn resource importsãçµç±ããã«ãcdkã®ã³ãã³ãã ãã§åãè¾¼ããã¨ãã§ããããã«ãªãã¾ããããããããªã½ã¼ã¹ã®è¨å®ã«åããã¦ã³ã¼ããä¿®æ£ããå¿
è¦ãããããã®é¨åããªããªã大å¤ã§ããTerraformã§ãåæ§ã®åé¡ãããã¾ãããããã解決ããTerraformerã¨ãããã¼ã«ããããããTerraformã ã¨æ¥½ã«åãè¾¼ããã¨ãã§ãã¾ãã
ããã¦æã¯æµããæè¿ã§ã¯ChatGPTãç»å ´ãCDKã®ã³ã¼ãã£ã³ã°ãå©ãã¦ãããããã«ãªãã¾ããã以åç§ãçºè¡¨ããCDKã¨ChatGPTã«é¢ããã¹ã©ã¤ãã¯ä»¥ä¸ã®ãªã³ã¯ããåç §ã§ãã¾ããCDKã¨ChatGPTã®é¢ä¿æ§ãç¥ãããæ¹ã¯ããã²ã覧ãã ããã
- CDK with ChatGPT
- ChatGPTã使ã£ãCDKã³ã¼ããã£ã³ã¯ãã®å¼·ã¿ã¨å¼±ã¿ãããã¦ãã®ä¹ãè¶ãæ¹
ChatGPTãCDKã³ã¼ãã£ã³ã°ãå©ãã¦ããããªããTerraformã®Terraformerã®ãããªå½¹å²ãChatGPTãæãããªãããã¨ãããã¨ãä»å試ãã¦ã¿ã¾ããã
ChatGPTã§ã¤ã³ãã¼ã
æ¬æ¥ã®ã¦ã¼ã¹ã±ã¼ã¹ã¨ã¯ç°ãªããæ£è§£ãã¼ã¿ã¨ã®æ¯è¼ãè¡ãããããã以ä¸ã®æé ã§å¯¾è±¡ã®ãªã½ã¼ã¹ã¨æ£è§£ã®CDKã³ã¼ããç¨æããChatGPTãå©ç¨ãã¦CDKã³ã¼ããçæãã¦ã¿ã¾ãã使ç¨ããè¨èªã¯Pythonã§ãã
- CDKã³ã¼ãã§å¯¾è±¡ãä½æ
- ãããã¤å¾ãCDKãããªã½ã¼ã¹ãåé¤
- åé¤ããªã·ã¼ãä¿æã«è¨å®ãã¦åé¤
- ã³ã¼ããããªã½ã¼ã¹ã®é¢é£ä»ãã解é¤ãã¦ãªã½ã¼ã¹ãä¿æ
- aws cliã使ç¨ãã¦ãªã½ã¼ã¹ã®æ å ±ãåå¾
- åå¾ããæ å ±ãChatGPTã«å ¥å
- ChatGPTããåºåãããCDKã³ã¼ããæ£è§£ãã¼ã¿ã¨æ¯è¼
1. CDKã³ã¼ãã§å¯¾è±¡ãä½æ
対象ã®ãªã½ã¼ã¹ã¯ä»åDynamoDBã¨ãã¾ããä»åã¯åºæ¬çã«ããã©ã«ãã®ãã®ãå©ç¨ããã³ã¼ãã¨ãã¦ãã¾ãã
table = dynamodb.Table( self, "MyTable", partition_key=dynamodb.Attribute( name="id", type=dynamodb.AttributeType.STRING ), table_name="manual_table", removal_policy=RemovalPolicy.RETAIN )
ä»åã¯ãã¡ããCDKã®æ£è§£ã³ã¼ãã¨ãã¦å©ç¨ãã¾ãã
2. ãããã¤å¾ãCDKãããªã½ã¼ã¹ãåé¤
ä¸è¨ã³ã¼ãããããã¤ãããã¼ãã«ä½æãã¾ãã
ãã®å¾å¯¾è±¡ãªã½ã¼ã¹ãã³ã¡ã³ãã¢ã¦ããªããã¦åé¤ããã¨ãåé¤ããªã·ã¼ã«RemovalPolicy.RETAIN
ãæå®ãã¦ããã®ã§ã³ã¼ãã¨é¢é£ãå¤ãã¾ãã
åºæ¥ããªã½ã¼ã¹ãä»åã®ChatGPTãå©ç¨ãã¦ã¤ã³ãã¼ãããããã®ã¨èãã¾ãã
3. aws cliã使ç¨ãã¦ãªã½ã¼ã¹ã®æ å ±ãåå¾
$ aws dynamodb describe-table --table-name manual_table { "Table": { "AttributeDefinitions": [ { "AttributeName": "id", "AttributeType": "S" } ], "TableName": "manual_table", "KeySchema": [ { "AttributeName": "id", "KeyType": "HASH" } ], "TableStatus": "ACTIVE", "CreationDateTime": "2023-05-18T04:03:18.450000+00:00", "ProvisionedThroughput": { "NumberOfDecreasesToday": 0, "ReadCapacityUnits": 5, "WriteCapacityUnits": 5 }, "TableSizeBytes": 0, "ItemCount": 0, "TableArn": "arn:aws:dynamodb:ap-northeast-1:XXXXXXXXXXXX:table/manual_table", "TableId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "DeletionProtectionEnabled": false } }
4. åå¾ããæ å ±ãChatGPTã«å ¥å
3ã§å¾ãæ å ±ãChatGPTã«å ¥åããCDKã³ã¼ããçæãã¦ãããã¾ããChatGPTã«å ¥åããå 容ã¯ä¸è¨ã§ãã
ä¸è¨ãaws cliã§æ å ±åå¾ããçµæã§ãããã®çµæãå ã«åããã®ãä½ãããã«Pythonã§CDKã³ã¼ããä½æãã¦ãChatGPTã§ä½ã£ããã¨ããããããã«ã³ã¼ãããªã½ã¼ã¹åãä¿®æ£ãã¦ã
3ã®å 容ãã³ãã¼
5. ChatGPTããåºåãããCDKã³ã¼ããæ£è§£ãã¼ã¿ã¨æ¯è¼
4ã§åºåãããã³ã¼ãããå¿ è¦ãªé¨åãæãåºãããã®ã¯ä¸è¨ã«ãªãã¾ãã
table = ddb.Table( self, "ChatGPTTable", partition_key=ddb.Attribute( name="id", type=ddb.AttributeType.STRING ), table_name="chatgpt_table_replica", # Replace with your new table name billing_mode=ddb.BillingMode.PROVISIONED, # Provisioned mode read_capacity=5, # Read capacity units write_capacity=5, # Write capacity units removal_policy=core.RemovalPolicy.RETAIN # NOT recommended for production code )
ã¢ã¸ã¥ã¼ã«åãåºæåã®é¨åãé¤ããCDK v1ç³»ã§åºåãã¦ãããã«ä»ãã¦ããcoreã®é¨åãé¤ãã¨ãä»åã®æ£è§£ãã¼ã¿ã¨éãã®ã¯ä¸è¨ã«ãªãã¾ãã
billing_mode=ddb.BillingMode.PROVISIONED, # Provisioned mode read_capacity=5, # Read capacity units write_capacity=5, # Write capacity units
ãã¡ãã¯CDKããã¥ã¡ã³ãã確èªããã¨ãå ¨ã¦ããã©ã«ãã®å¤ã§æ示çã«å ¥ãã¦ããã ããªã®ã§ãçµæçã«å·®åã¯ããã¾ããã§ããã
æ¤è¨¼çµæ
ä¸è¨ã®æ¤è¨¼çµæãããaws cliã®åºåããåé¡ãªãCDKã³ã¼ããçæã§ãããã¨ã確èªã§ãã¾ãããæ¤è¨¼ãé²ããä¸ã§ããã¤ã注æç¹ããã£ãã®ã§ãããããå ±æãã¾ãã
å ¥åæ å ±ä»¥å¤ã¯ä¸å®å®
ã¾ããcliããåå¾ããå
容以å¤ã®æ
å ±ã¯å¿
ãããæ£ç¢ºã§ã¯ãªããã¨ãããã¾ãããããã¯å½ç¶ã¨è¨ãã°å½ç¶ã§ãå
¥åããæ
å ±ã«å«ã¾ãã¦ããªããããChatGPTãããã解éãããã¨ã¯ã§ãã¾ãããããããChatGPTã¯èªåçã«è§£éãã¦è£å®ãã¦ããããããå¤ãã®å ´åããããã¤å¯è½ãªç¶æ
ã«ãªã£ã¦ãã¾ããä»åã®å ´åã removal_policy
ã¯DynamoDBã®æ
å ±ã§ã¯ãªããCDKãCloudFormationå´ã®æ
å ±ã«ãªããããåºåã®ã¿ã¤ãã³ã°ã§é »ç¹ã«å¤åãã¦ãã¾ããããã®ãããç¹å®ã®å¤ãåºå®ãããå ´åã¯ãChatGPTã¸ã®å
¥åæã«ãã®è¦ä»¶ã追å ããã¨ãçµæã®ãã¬ãå°ãªããªãã¾ãã
å çã§ã¯ãªãå¯æ縦士
以åã®çºè¡¨ã§ãè¿°ã¹ãããã«ãChatGPTã¯ããã¾ã§ã³ã¼ãã£ã³ã°ãã¼ããã¼ã¨ãã¦å©ç¨ããã®ãæé©ã§ãããã®ãããChatGPTã¸ã®å ¥åçµæãåä½ããªãå ´åã§ãããã«è«¦ããã®ã¯ãã£ãããªãã¨æãã¾ããã¨ã©ã¼å 容ãINPUTã¨ãã¦å¾ç¶ã®ä¼è©±ã«å©ç¨ããããcdk v1ã®ã³ã¼ããæåã§ä¿®æ£ãããã¨ãä¸ç·ã«ã³ã¼ãã£ã³ã°ããã¨ããè¦ç¹ãå¿ããªããã¨ãéè¦ã§ãã
ã³ãã³ãä½æã®è² è·
ã¾ããä»åã¯æ å ±åå¾ã®ã³ãã³ããå°ãªããCDKã³ã¼ããç°¡åã«ä½æã§ããDynamoDBã対象ã¨ãã¾ãããå½åã¯S3ãèãã¦ããã®ã§ãããS3ã®æ å ±åå¾ã®APIã¯å¤ããaws s3apiã®ãªãã¡ã¬ã³ã¹ãè¦ãã¨ããã±ããã®æ å ±åå¾ã®ã³ãã³ãã¯21åãããã¾ãããã®ãããChatGPTã«æ¸¡ãããã®ã³ãã³ãã21åã®ã³ãã³ãå 容ã¨çµæãå¿ è¦ã«ãªããçµæçã«ã¯æéããããã¾ãããã®ãããæ å ±åå¾ã®ããã®ã³ã¹ããå¢ãã¾ãã
ãã ãããããã®ã³ãã³ããChatGPTã«ä½æãã¦ããããã¨ã¯å¯è½ã§ãã以ä¸ã¯ãChatGPTã«é å¼µã£ã¦ä½æãã¦ããã£ãã¨ãã®ä¼è©±ã®ä¸é¨ã§ãã
æçµçã«ã¯ä¸è¨ã®ãããªã¹ã¯ãªãããã§ãã¾ããã
#!/bin/bash # Define the bucket name BUCKET_NAME="my-bucket" # Use the bucket name in AWS CLI commands echo "Getting bucket accelerate configuration..." aws s3api get-bucket-accelerate-configuration --bucket $BUCKET_NAME echo "Getting bucket ACL..." aws s3api get-bucket-acl --bucket $BUCKET_NAME echo "Getting bucket CORS..." aws s3api get-bucket-cors --bucket $BUCKET_NAME echo "Getting bucket encryption..." aws s3api get-bucket-encryption --bucket $BUCKET_NAME echo "Getting bucket lifecycle configuration..." aws s3api get-bucket-lifecycle-configuration --bucket $BUCKET_NAME echo "Getting bucket location..." aws s3api get-bucket-location --bucket $BUCKET_NAME echo "Getting bucket logging..." aws s3api get-bucket-logging --bucket $BUCKET_NAME echo "Getting bucket notification configuration..." aws s3api get-bucket-notification-configuration --bucket $BUCKET_NAME echo "Getting bucket ownership controls..." aws s3api get-bucket-ownership-controls --bucket $BUCKET_NAME echo "Getting bucket policy..." aws s3api get-bucket-policy --bucket $BUCKET_NAME echo "Getting bucket policy status..." aws s3api get-bucket-policy-status --bucket $BUCKET_NAME echo "Getting bucket replication..." aws s3api get-bucket-replication --bucket $BUCKET_NAME echo "Getting bucket request payment..." aws s3api get-bucket-request-payment --bucket $BUCKET_NAME echo "Getting bucket tagging..." aws s3api get-bucket-tagging --bucket $BUCKET_NAME echo "Getting bucket versioning..." aws s3api get-bucket-versioning --bucket $BUCKET_NAME echo "Getting bucket website..." aws s3api get-bucket-website --bucket $BUCKET_NAME echo "Getting public access block..." aws s3api get-public-access-block --bucket $BUCKET_NAME
ãããã«
ä»åã®æ¤è¨¼ã§ã¯ãaws cliã§æ å ±ãåå¾ãããããChatGPTã«å ¥åãã¦CDKã³ã¼ããçæãããã®å¾cdk importã§æ¢åãªã½ã¼ã¹ã¨ç´ä»ããã¨ããæµãã§ãæ¢åãªã½ã¼ã¹ãCDKã§åãè¾¼ããã¨ãã§ãã¾ãããããã¯é常ã«æç¨ã§ãã ãã ããã©ã®æ®µéã«ããã¦ããæã ã¯LLMã®ä¸çã«ãããããä¸ç¢ºå®æ§ãé«ããã®ã¨ãªãã¾ãããã®ãããçæãããã³ã¼ããåé¡ãªããã©ããã¯é©å®æ¤è¨¼ãããã¨ãéè¦ã§ãã ã¾ãããã®è¨äºãæ¸ãã¦ããæç¹ã§ã®CDKã®ææ°ãã¼ã¸ã§ã³ã¯v2.79.1ã§ãcdk importã¯ã¾ã ãã¬ãã¥ã¼çã§ãããã¤ã³ãã¼ãå¾ã®ããªããæ¤ç¥ã¯ã¾ã å¤å°ä¸å®å®ãªé¨åãããã¾ãããã®ãããGAï¼ä¸è¬å©ç¨å¯è½ï¼ã«ãªãã¨æåãå¤ããå¯è½æ§ãããã¾ããããããããããã®è¨äºãå ¬éãã¦ãã2é±éãçµããªããã¡ã«GAã«ãªãããããã¾ãããããã®æã¯ã¾ãæ°ããªè¨äºãæ³£ããªããæ¸ãããã¨æãã¾ãã