aws-cdk
--disable-update-workflow
code: zsh
NODE_OPTIONS="--max-old-space-size=8192" npx lerna run build --scope=aws-cdk-lib
code: zsh
--skip-nx-cache
code: zsh
~/Desktop/aws-cdk/packages/aws-cdk-lib/aws-s3/test
$ NODE_OPTIONS="--max-old-space-size=8192" yarn build ./util.test.ts
~/Desktop/aws-cdk/packages/aws-cdk-lib/aws-s3/test
$ yarn test util
~/Desktop/aws-cdk/packages/aws-cdk-lib/aws-s3/test
$ yarn lint ./util.test.ts
code: zsh
aws-cdk-lib git:(main) npx tsc ./aws-ecs-patterns/test/fargate/load-balanced-fargate-service-v2.test.ts
失敗したら yarn install
buildしている間は動かさない
code: zsh
➜ aws-cdk-lib git:(ten-n-one-or) git push origin ten-n-one-or
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Remove Containerからpushしない
ログは残る
code: zsh
$ git log
commit 7d2c99e092730aadfc8725582ab9d39da917990d (HEAD -> ten-n-one-or)
Author: wafuwafu13 <jaruwafu@gmail.com>
Date: Tue Jun 6 21:49:57 2023 +0000
fix: drop the last wrapping Fn::Or
code: zsh
➜ test git:(main) yarn test auto-scaling-group.test.js
yarn run v1.22.19
$ jest auto-scaling-group.test.js
No tests found, exiting with code 1
Run with --passWithNoTests to exit with code 0
In /workspaces/aws-cdk/packages/aws-cdk-lib
8479 files checked.
testMatch: /workspaces/aws-cdk/packages/aws-cdk-lib/**/test/**/?(*.)+(test).ts - 697 matches
testPathIgnorePatterns: /node_modules/ - 8479 matches
testRegex: - 0 matches
Pattern: auto-scaling-group.test.js - 0 matches
error Command failed with exit code 1.
➜ test git:(main) yarn test auto-scaling-group
yarn run v1.22.19
$ jest auto-scaling-group
PASS aws-autoscaling/test/auto-scaling-group.test.ts (20.474 s)
code: zsh
➜ framework-integ git:(asg-instance-requirements) export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
npx lerna run build --scope=@aws-cdk-testing/framework-integ
npm install -g aws-cdk
cdk bootstrap aws://534165444269/ap-northeast-1
yarn integ aws-ecs-patterns/test/fargate/integ.alb-foo.js --update-on-failed --parallel-regions eu-west-2
.lock 削除, --skip-nx-cache 意味ないので新しくファイルを作成して試す
issue
code: packages/aws-cdk-lib/aws-ecs-patterns/lib/fargate/network-load-balanced-fargate-service.ts
/**
* The security groups to associate with the service. If you do not specify a security group, a new security group is created.
*
* @default - A new security group is created.
*/
readonly securityGroups?: ISecurityGroup[];
If you do not specify a security group, a new security group is created. <- 本当に?
code: packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/aws-ecs-integ-lb-fargate.template.json
"Type": "AWS::ElasticLoadBalancingV2::LoadBalancer"
-> NLB には sg ない(修正前)
issue
Admin ロールの信頼ポリシーに追加
issue
code: packages/@aws-cdk-testing/framework-integ/test/aws-route53-patterns/test/integ.hosted-redirect-same-region.ts
const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID ?? process.env.HOSTED_ZONE_ID;
if (!hostedZoneId) throw new Error('For this test you must provide your own HostedZoneId as an env var "HOSTED_ZONE_ID". See framework-integ/README.md for details.');
const hostedZoneName = process.env.CDK_INTEG_HOSTED_ZONE_NAME ?? process.env.HOSTED_ZONE_NAME;
if (!hostedZoneName) throw new Error('For this test you must provide your own HostedZoneName as an env var "HOSTED_ZONE_NAME". See framework-integ/README.md for details.');
const domainName = process.env.CDK_INTEG_DOMAIN_NAME ?? process.env.DOMAIN_NAME;
if (!domainName) throw new Error('For this test you must provide your own DomainName as an env var "DOMAIN_NAME". See framework-integ/README.md for details.');
code: zsh
$ curl 18.201.145.54
<h1>Hello World</h1>
$ curl dub28-928315127.eu-west-1.elb.amazonaws.com
<h1>Hello World</h1>
$ curl (alias).hjk.jp
<h1>Hello World</h1>
<h1>Hello World</h1>
code: packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts
if (protocol === ApplicationProtocol.HTTPS) {
if (props.certificate !== undefined) {
this.certificate = props.certificate;
} else {
if (typeof props.domainName === 'undefined' || typeof props.domainZone === 'undefined') {
throw new Error('A domain name and zone is required when using the HTTPS protocol');
}
this.certificate = new Certificate(this, 'Certificate', {
domainName: props.domainName,
validation: CertificateValidation.fromDns(props.domainZone),
});
}
}
code:ts
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as eks from 'aws-cdk-lib/aws-eks';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
export class CdkPlaygroundStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const vpc = new ec2.Vpc(this, 'VPC', {
maxAzs: 3
});
const cluster = new eks.Cluster(this, 'EKSCluster', {
vpc,
version: eks.KubernetesVersion.V1_29,
defaultCapacity: 0
});
cluster.addNodegroupCapacity('Inf2NodeGroup', {
minSize: 1,
});
}
}
code: zsh
AWS_DEFAULT_REGION=eu-west-2 cdk deploy
code: zsh
code: zsh
➜ test git:(integ-fargate-domain) yarn integ --disable-update-workflow aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js d s 2
yarn run v1.22.19
$ integ-runner --language javascript --disable-update-workflow aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js
Verifying integration test snapshots...
CHANGED aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https 2.81s
Resources
~ AWS::CertificateManager::Certificate myServiceCertificate152F9DDA replace ├─ ~ DomainName (requires replacement) └─ ~ DomainValidationOptions (requires replacement) └─ @@ -1,6 +1,6 @@
[
{
- "DomainName": "test.example.com", - "HostedZoneId": "fakeId" + "DomainName": "*.example.com", + "HostedZoneId": "Z23ABC4XYZL05B" }
]
~ AWS::Route53::RecordSet myServiceDNSD76FB53A replace ├─ ~ HostedZoneId (requires replacement) └─ ~ Name (requires replacement) Snapshot Results:
Tests: 1 failed, 1 total
Failed: /workspaces/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js
!!! This test contains destructive changes !!!
Stack: aws-ecs-integ-alb-fg-https - Resource: myServiceCertificate152F9DDA - Impact: WILL_REPLACE
Stack: aws-ecs-integ-alb-fg-https - Resource: myServiceDNSD76FB53A - Impact: WILL_REPLACE
!!! If these destructive changes are necessary, please indicate this on the PR !!!
Error: Some changes were destructive!
at main (/workspaces/aws-cdk/packages/@aws-cdk/integ-runner/lib/cli.js:183:15)
error Command failed with exit code 1.
➜ test git:(integ-fargate-domain) yarn integ --disable-update-workflow aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js --update-on-failed --parallel-regions eu-west-2
yarn run v1.22.19
$ integ-runner --language javascript --disable-update-workflow aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js --update-on-failed --parallel-regions eu-west-2
Verifying integration test snapshots...
CHANGED aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https 2.28s
Resources
~ AWS::CertificateManager::Certificate myServiceCertificate152F9DDA replace ├─ ~ DomainName (requires replacement) └─ ~ DomainValidationOptions (requires replacement) └─ @@ -1,6 +1,6 @@
[
{
- "DomainName": "test.example.com", - "HostedZoneId": "fakeId" + "DomainName": "*.example.com", + "HostedZoneId": "Z23ABC4XYZL05B" }
]
~ AWS::Route53::RecordSet myServiceDNSD76FB53A replace ├─ ~ HostedZoneId (requires replacement) └─ ~ Name (requires replacement) Snapshot Results:
Tests: 1 failed, 1 total
Failed: /workspaces/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js
!!! This test contains destructive changes !!!
Stack: aws-ecs-integ-alb-fg-https - Resource: myServiceCertificate152F9DDA - Impact: WILL_REPLACE
Stack: aws-ecs-integ-alb-fg-https - Resource: myServiceDNSD76FB53A - Impact: WILL_REPLACE
!!! If these destructive changes are necessary, please indicate this on the PR !!!
Running integration tests for failed tests...
Running in parallel across regions: eu-west-2
Running test /workspaces/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js in eu-west-2
issue
整理
issue
issue
code: zsh
$ aws elbv2 describe-load-balancers --names aws-ec-ALBFa-upovB6px7ex9 --region eu-west-2
{
"LoadBalancers": [
{
"LoadBalancerArn": "arn:aws:elasticloadbalancing:eu-west-2:xxx:loadbalancer/app/aws-ec-ALBFa-upovB6px7ex9/1b0d62273ea4180c",
"DNSName": "aws-ec-ALBFa-upovB6px7ex9-1054150935.eu-west-2.elb.amazonaws.com",
"CanonicalHostedZoneId": "ZHURV8PSTC4K8",
"CreatedTime": "2024-03-01T16:51:30.470000+00:00",
"LoadBalancerName": "aws-ec-ALBFa-upovB6px7ex9",
"Scheme": "internet-facing",
"VpcId": "vpc-0713b58c6765f7d87",
"State": {
"Code": "active"
},
"Type": "application",
"AvailabilityZones": [
{
"ZoneName": "eu-west-2b",
"SubnetId": "subnet-05dcf249d06336e39",
"LoadBalancerAddresses": []
},
{
"ZoneName": "eu-west-2a",
"SubnetId": "subnet-0cf0fcd94dfd4bd2f",
"LoadBalancerAddresses": []
}
],
"SecurityGroups": [
"sg-0fdff890b0876eabf"
],
"IpAddressType": "ipv4"
}
]
}
$ aws elbv2 describe-load-balancers --names aws-ec-NLBFa-D5tqq6UBeN9u --region eu-west-2
{
"LoadBalancers": [
{
"LoadBalancerArn": "arn:aws:elasticloadbalancing:eu-west-2:xxx:loadbalancer/net/aws-ec-NLBFa-D5tqq6UBeN9u/237e00ce858451b0",
"DNSName": "aws-ec-NLBFa-D5tqq6UBeN9u-237e00ce858451b0.elb.eu-west-2.amazonaws.com",
"CanonicalHostedZoneId": "ZD4D7Y8KGAS4G",
"CreatedTime": "2024-03-01T16:51:30.375000+00:00",
"LoadBalancerName": "aws-ec-NLBFa-D5tqq6UBeN9u",
"Scheme": "internet-facing",
"VpcId": "vpc-0713b58c6765f7d87",
"State": {
"Code": "active"
},
"Type": "network",
"AvailabilityZones": [
{
"ZoneName": "eu-west-2b",
"SubnetId": "subnet-05dcf249d06336e39",
"LoadBalancerAddresses": []
},
{
"ZoneName": "eu-west-2a",
"SubnetId": "subnet-0cf0fcd94dfd4bd2f",
"LoadBalancerAddresses": []
}
],
"IpAddressType": "ipv4"
}
]
}
NLB にも両方必要
code: zsh
ALB
{
"SecurityGroups": [
{
"Description": "Automatically created Security Group for ELB awsecsinteglbfargateALBFargateServiceLBF93E98F2",
"GroupName": "aws-ecs-integ-lb-fargate-ALBFargateServiceLBSecurityGroup5DC3060E-1ROVY50YRPPO8",
"IpPermissions": [
{
"FromPort": 80,
"IpProtocol": "tcp",
"IpRanges": [
{
"CidrIp": "0.0.0.0/0",
"Description": "Allow from anyone on port 80"
}
],
"Ipv6Ranges": [],
"PrefixListIds": [],
"ToPort": 80,
"UserIdGroupPairs": []
}
],
"OwnerId": "534165444269",
"GroupId": "sg-0fdff890b0876eabf",
"IpPermissionsEgress": [
{
"FromPort": 80,
"IpProtocol": "tcp",
"IpRanges": [],
"Ipv6Ranges": [],
"PrefixListIds": [],
"ToPort": 80,
"UserIdGroupPairs": [
{
"Description": "Load balancer to target",
"GroupId": "sg-067f244106a7d62c8",
"UserId": "534165444269"
}
]
}
],
"Tags": [
{
"Key": "aws:cloudformation:stack-id",
"Value": "arn:aws:cloudformation:eu-west-2:534165444269:stack/aws-ecs-integ-lb-fargate/dc5d1c00-d7eb-11ee-aee7-02887ba073dd"
},
{
"Key": "aws:cloudformation:logical-id",
"Value": "ALBFargateServiceLBSecurityGroup5DC3060E"
},
{
"Key": "aws:cloudformation:stack-name",
"Value": "aws-ecs-integ-lb-fargate"
}
],
"VpcId": "vpc-0713b58c6765f7d87"
}
]
}
code: zsh
Service
{
"SecurityGroups": [
{
"Description": "aws-ecs-integ-lb-fargate/ALBFargateService/Service/SecurityGroup",
"GroupName": "aws-ecs-integ-lb-fargate-ALBFargateServiceSecurityGroup82F7A67E-LFTPDIEUO2KP",
"IpPermissions": [
{
"FromPort": 80,
"IpProtocol": "tcp",
"IpRanges": [],
"Ipv6Ranges": [],
"PrefixListIds": [],
"ToPort": 80,
"UserIdGroupPairs": [
{
"Description": "Load balancer to target",
"GroupId": "sg-0235aaf2f40b6789d",
"UserId": "534165444269"
}
]
}
],
"OwnerId": "534165444269",
"GroupId": "sg-0f44ab61bdb7cd805",
"IpPermissionsEgress": [
{
"IpProtocol": "-1",
"IpRanges": [
{
"CidrIp": "0.0.0.0/0",
"Description": "Allow all outbound traffic by default"
}
],
"Ipv6Ranges": [],
"PrefixListIds": [],
"UserIdGroupPairs": []
}
],
"Tags": [
{
"Key": "aws:cloudformation:stack-name",
"Value": "aws-ecs-integ-lb-fargate"
},
{
"Key": "aws:cloudformation:stack-id",
"Value": "arn:aws:cloudformation:eu-west-3:534165444269:stack/aws-ecs-integ-lb-fargate/b047c240-d7fb-11ee-9c12-0ed8ce3f7ff3"
},
{
"Key": "aws:cloudformation:logical-id",
"Value": "ALBFargateServiceSecurityGroup82F7A67E"
}
],
"VpcId": "vpc-0f52b6c8d3e3628d6"
}
]
}
code: packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/nlb/network-load-balancer.ts
/**
* value for securityGroups is set by the ec2.Connections constructor to an empty array.
* To keep backward compatibility (securityGroups is undefined if the related property is not specified)
* a getter has been added.
*/
public get securityGroups(): string[] | undefined {
return this.isSecurityGroupsPropertyDefined || this.connections.securityGroups.length
? this.connections.securityGroups.map(sg => sg.securityGroupId)
: undefined;
}
指定できない!!
code:ts
// Create NLB service
const networkLoadBalancedFargateService = new ecsPatterns.NetworkLoadBalancedFargateService(stack, 'NLBFargateService', {
cluster,
memoryLimitMiB: 1024,
cpu: 512,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
},
secu..
});
code: packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js.snapshot/aws-ecs-integ-lb-fargate.template.json
"Type": "AWS::ElasticLoadBalancingV2::LoadBalancer"
-> NLB には sg ない
code: zsh
➜ test git:(integ-fargate-domain) yarn integ aws-ecs-patterns/test/fargate/integ.l3.js --disable-update-workflow --update-on-failed --parallel-regions eu-west-2
yarn run v1.22.19
$ integ-runner --language javascript aws-ecs-patterns/test/fargate/integ.l3.js --disable-update-workflow --update-on-failed --parallel-regions eu-west-2
Verifying integration test snapshots...
CHANGED aws-ecs-patterns/test/fargate/integ.l3 2.329s
Security Group Changes
┌───┬──────────────────────────────────┬─────┬─────────────┬────────────────────┐
│ │ Group │ Dir │ Protocol │ Peer │
├───┼──────────────────────────────────┼─────┼─────────────┼────────────────────┤
│ + │ ${SecurityGroupDD263621.GroupId} │ In │ TCP 80 │ Everyone (IPv4) │
│ + │ ${SecurityGroupDD263621.GroupId} │ Out │ ICMP 252-86 │ 255.255.255.255/32 │
└───┴──────────────────────────────────┴─────┴─────────────┴────────────────────┘
Resources
- AWS::EC2::SecurityGroup NLBFargateServiceSecurityGroup9D81388B destroy + AWS::EC2::SecurityGroup SecurityGroupDD263621 ~ AWS::ECS::Service NLBFargateServiceB92AC095 └─ ~ NetworkConfiguration └─ ~ .AwsvpcConfiguration: └─ @@ -1,7 +1,7 @@
[
{
"Fn::GetAtt": [
- "NLBFargateServiceSecurityGroup9D81388B", + "SecurityGroupDD263621", "GroupId"
]
}
Snapshot Results:
Tests: 1 failed, 1 total
Failed: /workspaces/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js
!!! This test contains destructive changes !!!
Stack: aws-ecs-integ-lb-fargate - Resource: NLBFargateServiceSecurityGroup9D81388B - Impact: WILL_DESTROY
!!! If these destructive changes are necessary, please indicate this on the PR !!!
Running integration tests for failed tests...
Running in parallel across regions: eu-west-2
Running test /workspaces/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js in eu-west-2
-> SG 設定されてない
TODO:snapshotファイル消してみる
code: zsh
➜ test git:(integ-fargate-domain) yarn integ aws-ecs-patterns/test/fargate/integ.l3.js --disable-update-workflow --update-on-failed --parallel-regions eu-west-2
yarn run v1.22.19
$ integ-runner --language javascript aws-ecs-patterns/test/fargate/integ.l3.js --disable-update-workflow --update-on-failed --parallel-regions eu-west-2
Verifying integration test snapshots...
NEW aws-ecs-patterns/test/fargate/integ.l3 4.029s
Snapshot Results:
Tests: 1 failed, 1 total
Failed: /workspaces/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js
Running integration tests for failed tests...
Running in parallel across regions: eu-west-2
Running test /workspaces/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js in eu-west-2
-> SG 設定されてない
code: packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.ts
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ec2 = require("aws-cdk-lib/aws-ec2");
var ecs = require("aws-cdk-lib/aws-ecs");
var cdk = require("aws-cdk-lib");
var integ = require("@aws-cdk/integ-tests-alpha");
var ecsPatterns = require("aws-cdk-lib/aws-ecs-patterns");
var app = new cdk.App();
var stack = new cdk.Stack(app, 'aws-ecs-integ-lb-fargate');
// Create VPC and cluster
var vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2, restrictDefaultSecurityGroup: false });
var cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc: vpc });
var securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', {
vpc: vpc,
allowAllOutbound: true,
});
securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(80));
// Create ALB service
var applicationLoadBalancedFargateService = new ecsPatterns.ApplicationLoadBalancedFargateService(stack, 'ALBFargateService', {
cluster: cluster,
memoryLimitMiB: 1024,
cpu: 512,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
},
});
applicationLoadBalancedFargateService.loadBalancer.connections.addSecurityGroup(securityGroup);
// Create NLB service
var networkLoadBalancedFargateService = new ecsPatterns.NetworkLoadBalancedFargateService(stack, 'NLBFargateService', {
cluster: cluster,
memoryLimitMiB: 1024,
cpu: 512,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
},
});
networkLoadBalancedFargateService.loadBalancer.connections.addSecurityGroup(securityGroup);
new integ.IntegTest(app, 'l3FargateTest', {
});
app.synth();
code: zsh
➜ test git:(integ-fargate-domain) yarn integ aws-ecs-patterns/test/fargate/integ.l3.js --disable-update-workflow --update-on-failed --parallel-regions eu-west-2
yarn run v1.22.19
$ integ-runner --language javascript aws-ecs-patterns/test/fargate/integ.l3.js --disable-update-workflow --update-on-failed --parallel-regions eu-west-2
Verifying integration test snapshots...
CHANGED aws-ecs-patterns/test/fargate/integ.l3 3.749s
Security Group Changes
┌───┬───────────────────────────────────────────────────┬─────┬─────────────┬──────────────────────────────────┐
│ │ Group │ Dir │ Protocol │ Peer │
├───┼───────────────────────────────────────────────────┼─────┼─────────────┼──────────────────────────────────┤
│ - │ ${SecurityGroupDD263621.GroupId} │ Out │ ICMP 252-86 │ 255.255.255.255/32 │
├───┼───────────────────────────────────────────────────┼─────┼─────────────┼──────────────────────────────────┤
│ + │ ${ALBFargateServiceSecurityGroup82F7A67E.GroupId} │ In │ TCP 80 │ ${SecurityGroupDD263621.GroupId} │
├───┼───────────────────────────────────────────────────┼─────┼─────────────┼──────────────────────────────────┤
│ + │ ${SecurityGroupDD263621.GroupId} │ Out │ Everything │ Everyone (IPv4) │
└───┴───────────────────────────────────────────────────┴─────┴─────────────┴──────────────────────────────────┘
Resources
+ AWS::EC2::SecurityGroupIngress ALBFargateServiceSecurityGroupfromawsecsinteglbfargateSecurityGroupCFF5F77180898CD07C ~ AWS::EC2::SecurityGroup SecurityGroupDD263621 └─ @@ -1,9 +1,7 @@
[
{
- "CidrIp": "255.255.255.255/32", - "Description": "Disallow all traffic", + "Description": "Allow all outbound traffic by default", }
]
~ AWS::ElasticLoadBalancingV2::LoadBalancer ALBFargateServiceLB64A0074E └─ @@ -4,5 +4,11 @@
"ALBFargateServiceLBSecurityGroup5DC3060E",
"GroupId"
]
+ "SecurityGroupDD263621", }
]
Snapshot Results:
Tests: 1 failed, 1 total
Failed: /workspaces/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js
Running integration tests for failed tests...
Running in parallel across regions: eu-west-2
Running test /workspaces/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js in eu-west-2
SUCCESS aws-ecs-patterns/test/fargate/integ.l3-l3FargateTest/DefaultTest 1009.563s
NO ASSERTIONS
Test Results:
Tests: 1 passed, 1 total
issue
code: zsh
$ docker pull public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest
latest: Pulling from ecs-sample-image/amazon-ecs-sample
31b3f1ad4ce1: Pull complete
fd42b079d0f8: Pull complete
30585fbbebc6: Pull complete
18f4ffdd25f4: Pull complete
9dc932c8fba2: Pull complete
600c24b8ba39: Pull complete
0e3bc9105e7b: Pull complete
Digest: sha256:7ebff78b7d7bd0cb13d462ecf4d9aaa6ea7571bd5548008163d0499eae2fbf40
Status: Downloaded newer image for public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest
public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest
What's Next?
View summary of image vulnerabilities and recommendations → docker scout quickview public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest
~/desktop
$ docker run -d --name ecs-sample-container public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
98a973d886ef01e9027c5a6d2dc045a4d050b84e906a8adb67762fe6e9fd46e6
~/desktop
$ docker exec -it ecs-sample-container /bin/sh
# /usr/sbin/apache2 -D FOREGROUND
/bin/sh: 1: /usr/sbin/apache2: not found
# ls
bin boot dev docker-entrypoint.d docker-entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
# pwd
/
# exit
~/desktop
$ docker exec -it ecs-sample-container /bin/bash -l -c
/bin/bash: -c: option requires an argument
~/desktop
$ docker exec -it ecs-sample-container /bin/bash -l -c /usr/sbin/apache2 -D FOREGROUND
-D: line 1: /usr/sbin/apache2: No such file or directory
~/desktop
$ docker exec -it ecs-sample-container /bin/bash -l -c sleep 1000
sleep: missing operand
Try 'sleep --help' for more information.
~/desktop
$ docker exec -it ecs-sample-container /bin/bash -l -c "sleep 1000"
code: zsh
$ aws elbv2 describe-target-health --target-group-arn arn:aws:elasticloadbalancing:eu-west-2:xxxx:targetgroup/aws-ec-ALBEC-THXCQGB6J3RW/601b10fee1cdfc71 --region eu-west-2
{
"TargetHealthDescriptions": [
{
"Target": {
"Id": "i-002586bbfd1f02d84",
"Port": 32788
},
"HealthCheckPort": "32788",
"TargetHealth": {
"State": "unhealthy",
"Reason": "Target.Timeout",
"Description": "Request timed out"
}
},
{
"Target": {
"Id": "i-002586bbfd1f02d84",
"Port": 32787
},
"HealthCheckPort": "32787",
"TargetHealth": {
"State": "draining",
"Reason": "Target.DeregistrationInProgress",
"Description": "Target deregistration is in progress"
}
}
]
}
code: packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.ts
const cx_api_1 = require("aws-cdk-lib/cx-api");
code: zsh
root@98a973d886ef:/usr/sbin# apt-get update && apt-get install -y net-tools lsof
root@98a973d886ef:/usr/sbin# lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 1 root 7u IPv4 9802419 0t0 TCP *:80 (LISTEN)
nginx 1 root 8u IPv6 9802420 0t0 TCP *:80 (LISTEN)
code: zsh
root@3f35beb5a668:/usr/local/apache2# httpd-foreground
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
issue
/workspaces/aws-cdk/packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts refactor
issue
code: packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-ipaddress-type.ts
import * as autoscaling from 'aws-cdk-lib/aws-autoscaling';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as ecs from 'aws-cdk-lib/aws-ecs';
import * as cdk from 'aws-cdk-lib';
import * as integ from '@aws-cdk/integ-tests-alpha';
import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns';
import { AUTOSCALING_GENERATE_LAUNCH_TEMPLATE } from 'aws-cdk-lib/cx-api';
import { IpAddressType } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
const stack = new cdk.Stack(app, 'aws-ecs-integ-alb-ec2-cmd-entrypoint');
// Create VPC and ECS Cluster
const vpc = new ec2.Vpc(stack, 'Vpc', { maxAzs: 2, restrictDefaultSecurityGroup: false });
const cluster = new ecs.Cluster(stack, 'Ec2Cluster', { vpc });
const provider = new ecs.AsgCapacityProvider(stack, 'CapacityProvier', {
autoScalingGroup: new autoscaling.AutoScalingGroup(
stack,
'AutoScalingGroup',
{
vpc,
instanceType: new ec2.InstanceType('t2.micro'),
machineImage: ecs.EcsOptimizedImage.amazonLinux2(),
},
),
capacityProviderName: 'test-capacity-provider',
});
cluster.addAsgCapacityProvider(provider);
// Create ALB service with Command and EntryPoint
new ecsPatterns.ApplicationLoadBalancedEc2Service(
stack,
'ALBECSServiceWithCommandEntryPoint',
{
cluster,
memoryLimitMiB: 512,
cpu: 256,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
},
capacityProviderStrategies: [
{
capacityProvider: provider.capacityProviderName,
base: 1,
weight: 1,
},
],
ipAddressType: IpAddressType.DUAL_STACK,
},
);
new integ.IntegTest(app, 'AlbEc2ServiceWithCommandAndEntryPoint', {
});
app.synth();
code: zsh
❌ aws-ecs-integ-alb-ec2-cmd-entrypoint failed: Error: The stack named aws-ecs-integ-alb-ec2-cmd-entrypoint failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "You must specify subnets with an associated IPv6 CIDR block. (Service: ElasticLoadBalancingV2, Status Code: 400, Request ID: 9ede78e6-777b-4eb6-a986-0973cb9a261e)" (RequestToken: b4744d0d-f89d-47c1-3f5e-f4131dbd24e8, HandlerErrorCode: InvalidRequest)
at FullCloudFormationDeployment.monitorDeployment (/workspaces/aws-cdk/packages/aws-cdk/lib/api/deploy-stack.js:252:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.deployStack (/workspaces/aws-cdk/packages/aws-cdk/lib/cdk-toolkit.js:232:32)
at async /workspaces/aws-cdk/packages/aws-cdk/lib/util/work-graph.js:88:21
❌ Deployment failed: Error: The stack named aws-ecs-integ-alb-ec2-cmd-entrypoint failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "You must specify subnets with an associated IPv6 CIDR block. (Service: ElasticLoadBalancingV2, Status Code: 400, Request ID: 9ede78e6-777b-4eb6-a986-0973cb9a261e)" (RequestToken: b4744d0d-f89d-47c1-3f5e-f4131dbd24e8, HandlerErrorCode: InvalidRequest)
at FullCloudFormationDeployment.monitorDeployment (/workspaces/aws-cdk/packages/aws-cdk/lib/api/deploy-stack.js:252:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.deployStack (/workspaces/aws-cdk/packages/aws-cdk/lib/cdk-toolkit.js:232:32)
at async /workspaces/aws-cdk/packages/aws-cdk/lib/util/work-graph.js:88:21
packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.vpc-ipv6.ts
code: packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-ipaddress-type.ts
const vpc = new ec2.Vpc(stack, 'Vpc', {
maxAzs: 2,
restrictDefaultSecurityGroup: false,
ipProtocol: ec2.IpProtocol.DUAL_STACK,
subnetConfiguration: [
{
name: 'subnet1',
subnetType: ec2.SubnetType.PUBLIC,
ipv6AssignAddressOnCreation: true,
},
{
name: 'subnet2',
subnetType: ec2.SubnetType.PUBLIC,
ipv6AssignAddressOnCreation: true,
},
],
});
code: zsh
❌ aws-ecs-integ-alb-ec2-ipaddress-type failed: Error: The stack named aws-ecs-integ-alb-ec2-ipaddress-type failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: Resource handler returned message: "A load balancer cannot be attached to multiple subnets in the same Availability Zone (Service: ElasticLoadBalancingV2, Status Code: 400, Request ID: 6b6fe297-c528-4daa-84b0-5009aacd529a)" (RequestToken: dcd47275-9cb0-40a0-80e6-207c1ded2305, HandlerErrorCode: InvalidRequest)
at FullCloudFormationDeployment.monitorDeployment (/workspaces/aws-cdk/packages/aws-cdk/lib/api/deploy-stack.js:252:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.deployStack (/workspaces/aws-cdk/packages/aws-cdk/lib/cdk-toolkit.js:232:32)
at async /workspaces/aws-cdk/packages/aws-cdk/lib/util/work-graph.js:88:21
パブリック有効
code: packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-ipaddress-type.ts
mapPublicIpOnLaunch: true,
ipv6AssignAddressOnCreation: true,
code: packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-ipaddress-type.ts
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as ecs from 'aws-cdk-lib/aws-ecs';
import * as cdk from 'aws-cdk-lib';
import * as integ from '@aws-cdk/integ-tests-alpha';
import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns';
import { AUTOSCALING_GENERATE_LAUNCH_TEMPLATE } from 'aws-cdk-lib/cx-api';
import { IpAddressType } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
const stack = new cdk.Stack(app, 'aws-ecs-integ-alb-fargate-ipaddress-type');
// Create VPC and ECS Cluster
const vpc = new ec2.Vpc(stack, 'Vpc', {
maxAzs: 2,
restrictDefaultSecurityGroup: false,
ipProtocol: ec2.IpProtocol.DUAL_STACK,
subnetConfiguration: [
{
name: 'subnet',
subnetType: ec2.SubnetType.PUBLIC,
mapPublicIpOnLaunch: true,
ipv6AssignAddressOnCreation: true,
},
],
});
const cluster = new ecs.Cluster(stack, 'FargateCluster', { vpc });
// Create ALB service with ipAddressType
new ecsPatterns.ApplicationLoadBalancedFargateService(
stack,
'AlbFargateServiceWithIpAddressType',
{
cluster,
memoryLimitMiB: 512,
cpu: 256,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
},
ipAddressType: IpAddressType.DUAL_STACK,
},
);
new integ.IntegTest(app, 'AlbFargateServiceWithIpAddressType', {
});
app.synth();
code: zsh
https://scrapbox.io/files/65d52134cfe07e00265c3f43.png
code:packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-ipaddress-type.ts
assignPublicIp: true,
code: zsh
$ yarn integ aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js --update-on-failed --parallel-regions eu-west-1
yarn run v1.22.19
$ integ-runner --language javascript aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js --update-on-failed --parallel-regions eu-west-1
Verifying integration test snapshots...
CHANGED aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service 0.894s
Resources
~ AWS::ElasticLoadBalancingV2::LoadBalancer myServiceLB168895E1 └─ ipv4
Snapshot Results:
Tests: 1 failed, 1 total
Failed: /Users/herotaka/Desktop/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js
Running integration tests for failed tests...
Running in parallel across regions: eu-west-1
Running test /Users/herotaka/Desktop/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js in eu-west-1
issue
code: packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts
/**
* Target Group port of the network load balancer that will send requests to registered target
*
* @default 80
*/
readonly targetPort?: number;
const targetProps = {
port: props.targetPort ?? props.taskImageOptions?.containerPort ?? 80,
};
code: packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.ts
targetPort: 80,
code: packages/aws-cdk-lib/aws-ecs-patterns/README.md
Default port for target group is 80, but if targetPort is specified, it is evaluated first, and if taskImageOptions.containerPort is specified, it is evaluated next.
In the example below, the port for target group is 82.
`ts
declare const cluster: ecs.Cluster;
const loadBalancedFargateService = new ecsPatterns.NetworkLoadBalancedFargateService(this, 'Service', {
cluster,
memoryLimitMiB: 1024,
cpu: 512,
taskImageOptions: {
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
containerPort: 81,
},
targetPort: 82,
});
`
code: packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service-v2.test.ts
test('Fargate networkloadbalanced target group uses 80 as default port', () => {
// GIVEN
const stack = new Stack();
const vpc = new Vpc(stack, 'VPC');
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
const taskDefinition = new ecs.FargateTaskDefinition(stack, 'FargateTaskDef');
taskDefinition.addContainer('Container', {
image: ContainerImage.fromRegistry('public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest'),
portMappings: containerPort: 81 },
});
new NetworkLoadBalancedFargateService(stack, 'NLBService', {
cluster: cluster,
memoryLimitMiB: 1024,
cpu: 512,
taskDefinition,
listenerPort: 8181,
});
Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', {
Port: 80,
Protocol: 'TCP',
TargetType: 'ip',
VpcId: {
Ref: 'VPCB9E5F0B4',
},
});
});
test('Fargate networkloadbalanced target group uses targetPort when targetPort is set', () => {
// GIVEN
const stack = new Stack();
const vpc = new Vpc(stack, 'VPC');
const cluster = new ecs.Cluster(stack, 'Cluster', { vpc });
const taskDefinition = new ecs.FargateTaskDefinition(stack, 'FargateTaskDef');
taskDefinition.addContainer('Container', {
image: ContainerImage.fromRegistry('public.ecr.aws/ecs-sample-image/amazon-ecs-sample:latest'),
portMappings: containerPort: 80 },
});
new NetworkLoadBalancedFargateService(stack, 'NLBService', {
cluster: cluster,
memoryLimitMiB: 1024,
cpu: 512,
taskDefinition,
targetPort: 81,
listenerPort: 8181,
});
Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::TargetGroup', {
Port: 81,
Protocol: 'TCP',
TargetType: 'ip',
VpcId: {
Ref: 'VPCB9E5F0B4',
},
});
});
issue
親元
ssm.generated.ts
issue
code: asg.yaml
Resources:
MyLaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
ImageId: ami-0e347cff037f057c4
InstanceType: t2.micro
SecurityGroups:
- sg-0e2bd2a94e32529fb
MyAutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
MinSize: 1
MaxSize: 1
LaunchConfigurationName: !Ref MyLaunchConfig
VPCZoneIdentifier:
- subnet-0f233ab1a8c920b74
https://scrapbox.io/files/65855c5559c852002371c2a0.png
code: asg.yaml
MyAutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
MinSize: 1
MaxSize: 1
LaunchConfigurationName: !Ref MyLaunchConfig
VPCZoneIdentifier:
- subnet-0f233ab1a8c920b74
MixedInstancesPolicy:
LaunchTemplate:
Overrides:
- InstanceType: t2.small
https://scrapbox.io/files/65855cf63bcd9d0024751f1d.png
code: asg.yaml
Resources:
MyLaunchTemplate:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateData:
ImageId: ami-0e347cff037f057c4
InstanceType: t2.micro
MyAutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
MinSize: 1
MaxSize: 1
LaunchTemplate:
LaunchTemplateId: !Ref MyLaunchTemplate
Version: !GetAtt MyLaunchTemplate.LatestVersionNumber
https://scrapbox.io/files/65855e32dee8e2002388c567.png
code: asg.yaml
Resources:
MyLaunchTemplate:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateData:
ImageId: ami-0e347cff037f057c4
InstanceType: t2.micro
MyAutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
MinSize: 1
MaxSize: 1
MixedInstancesPolicy:
LaunchTemplate:
LaunchTemplateSpecification:
LaunchTemplateId: !Ref MyLaunchTemplate
Version: !GetAtt MyLaunchTemplate.LatestVersionNumber
Overrides:
- InstanceType: t2.small
https://scrapbox.io/files/65855e32dee8e2002388c567.png
code: asg.yaml
Overrides:
- InstanceType: t2.small
- InstanceRequirements:
VCpuCount:
Max: 10
Min: 2
MemoryMiB:
Min: 4096
code: console
Resource handler returned message: "You cannot mix single instance and instance requirements launch template override in the same mixed instance policy. Remove the launch template overrides that use single instance types, or the ones using instance requirements. (Service: AutoScaling, Status Code: 400, Request ID: e3d0027e-bfee-4a3c-981b-54d985fe41a4)" (RequestToken: 27a9b623-cdea-9df5-6a6f-0833dc46e815, HandlerErrorCode: InvalidRequest)
issue
DevContainer試す
code: zsh
~/desktop
$ sudo chmod 744 ~/.docker/buildx/current
Password:
~/desktop
$ ls -la ~/.docker/buildx/current
-rwxr--r-- 1 root staff 48 3 22 03:35 /Users/wafuwafu13/.docker/buildx/current
code: zsh
aws-cdk git:(main) NODE_OPTIONS="--max-old-space-size=8192" npx lerna run build --scope=aws-cdk-lib
Build times for aws-cdk-lib: Total time (6m40.4s) | /workspaces/aws-cdk/tools/@aws-cdk/cdk-build-tools/node_modules/jsii/bin/jsii (4m7.1s) | ts-node ./scripts/verify-imports-resolve-same.ts && ts-node ./scripts/verify-imports-shielded.ts && ts-node ./cx-api/build-tools/flag-report.ts (19.3s) | ts-node -P tsconfig.dev.json scripts/gen.ts (9.2s) | npx ts-node -P tsconfig.dev.json region-info/build-tools/generate-static-data.ts && (cp -f $(node -p 'require.resolve("aws-sdk/apis/metadata.json")') custom-resources/lib/aws-custom-resource/sdk-api-metadata.json && rm -rf custom-resources/test/aws-custom-resource/cdk.out) && (rm -rf core/test/fs/fixtures && cd core/test/fs && tar -xzf fixtures.tar.gz) && (rm -rf assets/test/fs/fixtures && cd assets/test/fs && tar -xzvf fixtures.tar.gz) (4.0s)
———————————————————————————————————————————————————————————————————————————————————————————————
Lerna (powered by Nx) Successfully ran target build for project aws-cdk-lib and 8 tasks it depends on (10m)
Nx read the output from the cache instead of running the command for 8 out of 9 tasks.
code: zsh
aws-cdk-lib git:(main) NODE_OPTIONS="--max-old-space-size=8192" yarn build
Build times for aws-cdk-lib: Total time (6m34.4s) | /workspaces/aws-cdk/tools/@aws-cdk/cdk-build-tools/node_modules/jsii/bin/jsii (3m58.9s) | ts-node ./scripts/verify-imports-resolve-same.ts && ts-node ./scripts/verify-imports-shielded.ts && ts-node ./cx-api/build-tools/flag-report.ts (18.9s) | ts-node -P tsconfig.dev.json scripts/gen.ts (8.6s) | npx ts-node -P tsconfig.dev.json region-info/build-tools/generate-static-data.ts && (cp -f $(node -p 'require.resolve("aws-sdk/apis/metadata.json")') custom-resources/lib/aws-custom-resource/sdk-api-metadata.json && rm -rf custom-resources/test/aws-custom-resource/cdk.out) && (rm -rf core/test/fs/fixtures && cd core/test/fs && tar -xzf fixtures.tar.gz) && (rm -rf assets/test/fs/fixtures && cd assets/test/fs && tar -xzvf fixtures.tar.gz) (4.2s)
Done in 394.77s.
Dockerの容量UPで解決
code: zsh
Killed
Error: /workspaces/aws-cdk/tools/@aws-cdk/cdk-build-tools/node_modules/jsii/bin/jsii --silence-warnings=reserved-word --add-deprecation-warnings --compress-assembly '--strip-deprecated /workspaces/aws-cdk/deprecated_apis.txt' exited with error code 137
Build failed.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
npm ERR! Lifecycle script build failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: aws-cdk-lib@0.0.0
npm ERR! at location: /workspaces/aws-cdk/packages/aws-cdk-lib
———————————————————————————————————————————————————————————————————————————
Lerna (powered by Nx) Ran target build for project aws-cdk-lib and 8 task(s) they depend on (7m)
✖ 1/9 failed
PR
code: cfn-fn.ts
if (conditions.length === 1) {
return conditions0 as ICfnRuleConditionExpression; }
● Console
console.dir
FnOr {
typeHint: 'string',
disambiguator: true
}
console.dir
FnOr {
value: {
'Fn::Or': [
]
},
typeHint: 'string',
disambiguator: true
}
console.dir
FnOr {
typeHint: 'string',
disambiguator: true
}
code: .ts
public static conditionOr(...conditions: ICfnConditionExpression[]): ICfnRuleConditionExpression {
if (conditions.length === 0) {
throw new Error('Fn.conditionOr() needs at least one argument');
}
if (conditions.length === 1) {
return conditions0 as ICfnRuleConditionExpression; }
// prevent the error "Fn::Or object requires a list of at least 2" when the condition is split into groups of 10 and 1
if (conditions.length > 10) {
return Fn.conditionOr(..._inGroupsOf(conditions, 10).map(group => Fn.conditionOr(...group)));
}
return Fn.conditionOr(..._inGroupsOf(conditions, 10).map(group => new FnOr(...group)));
}
code: .ts
test('condition length is 10n + 1 in Fn.conditionOr', () => {
// GIVEN
const stack = new cdk.Stack();
const expression = cdk.Fn.conditionOr(
cdk.Fn.conditionEquals('a', '1'),
cdk.Fn.conditionEquals('b', '2'),
cdk.Fn.conditionEquals('c', '3'),
cdk.Fn.conditionEquals('d', '4'),
cdk.Fn.conditionEquals('e', '5'),
cdk.Fn.conditionEquals('f', '6'),
cdk.Fn.conditionEquals('g', '7'),
cdk.Fn.conditionEquals('h', '8'),
cdk.Fn.conditionEquals('i', '9'),
cdk.Fn.conditionEquals('j', '10'),
cdk.Fn.conditionEquals('k', '11'),
);
// WHEN
new cdk.CfnCondition(stack, 'Condition', { expression });
// THEN
expect(toCloudFormation(stack)).toEqual({
Conditions: {
Condition: {
'Fn::Or': [
{
'Fn::Or': [
],
},
{
},
],
},
},
});
});
test('condition length is more than 10 in Fn.conditionOr', () => {
// GIVEN
const stack = new cdk.Stack();
const expression = cdk.Fn.conditionOr(
cdk.Fn.conditionEquals('a', '1'),
cdk.Fn.conditionEquals('b', '2'),
cdk.Fn.conditionEquals('c', '3'),
cdk.Fn.conditionEquals('d', '4'),
cdk.Fn.conditionEquals('e', '5'),
cdk.Fn.conditionEquals('f', '6'),
cdk.Fn.conditionEquals('g', '7'),
cdk.Fn.conditionEquals('h', '8'),
cdk.Fn.conditionEquals('i', '9'),
cdk.Fn.conditionEquals('j', '10'),
cdk.Fn.conditionEquals('k', '11'),
cdk.Fn.conditionEquals('l', '12'),
);
// WHEN
new cdk.CfnCondition(stack, 'Condition', { expression });
// THEN
expect(toCloudFormation(stack)).toEqual({
Conditions: {
Condition: {
'Fn::Or': [
{
'Fn::Or': [
],
},
{
'Fn::Or': [
],
},
],
},
},
});
});
issue
Node.of
issue
parseBucketName -> undefined
code: zsh
~/Desktop/aws-cdk/packages/aws-cdk-lib
$ yarn test
...
=============================== Coverage summary ===============================
Statements : 57.43% ( 59305/103261 )
Branches : 40.79% ( 16576/40633 )
Functions : 66.88% ( 11441/17105 )
Lines : 58.86% ( 57366/97449 )
================================================================================
Summary of all failing tests
FAIL custom-resources/test/aws-custom-resource/runtime/index.test.js
● SDK global credentials are never set
expect(received).toBeNull()
Received: {"accessKeyId": "AKIAXYXV522WQUUSSPE3", "disableAssumeRole": true, "expireTime": null, "expired": false, "filename": undefined, "httpOptions": null, "preferStaticCredentials": false, "profile": "default", "refreshCallbacks": [], "sessionToken": undefined, "tokenCodeFn": null}
67 | // THEN
68 | expect(AWS.config).toBeInstanceOf(AWS.Config);
69 | expect(AWS.config.credentials).toBeNull();
| ^
70 | });
71 |
72 | test('SDK credentials are not persisted across subsequent invocations', async () => {
at Object.toBeNull (custom-resources/test/aws-custom-resource/runtime/index.test.ts:69:34)
FAIL aws-lambda-nodejs/test/docker.test.js
● esbuild is available
expect(received).toBe(expected) // Object.is equality
Expected: 0
Received: 1
7 | expect(process.error).toBeUndefined();
8 | expect(process.status).toBe(0);
| ^
9 | });
10 |
11 | test('esbuild is available', () => {
at Object.toBe (aws-lambda-nodejs/test/docker.test.ts:8:26)
● can npm install with non root user
expect(received).toBe(expected) // Object.is equality
Expected: 0
Received: 1
7 | expect(process.error).toBeUndefined();
8 | expect(process.status).toBe(0);
| ^
9 | });
10 |
11 | test('esbuild is available', () => {
at Object.toBe (aws-lambda-nodejs/test/docker.test.ts:8:26)
● can yarn install with non root user
expect(received).toBe(expected) // Object.is equality
Expected: 0
Received: 1
7 | expect(process.error).toBeUndefined();
8 | expect(process.status).toBe(0);
| ^
9 | });
10 |
11 | test('esbuild is available', () => {
at Object.toBe (aws-lambda-nodejs/test/docker.test.ts:8:26)
● can pnpm install with non root user
expect(received).toBe(expected) // Object.is equality
Expected: 0
Received: 1
7 | expect(process.error).toBeUndefined();
8 | expect(process.status).toBe(0);
| ^
9 | });
10 |
11 | test('esbuild is available', () => {
at Object.toBe (aws-lambda-nodejs/test/docker.test.ts:8:26)
● cache folders have the right permissions
expect(received).toBe(expected) // Object.is equality
Expected: 0
Received: 1
7 | expect(process.error).toBeUndefined();
8 | expect(process.status).toBe(0);
| ^
9 | });
10 |
11 | test('esbuild is available', () => {
at Object.toBe (aws-lambda-nodejs/test/docker.test.ts:8:26)
Test Suites: 2 failed, 3 skipped, 650 passed, 652 of 655 total
Tests: 6 failed, 43 skipped, 10061 passed, 10110 total
Snapshots: 20 passed, 20 total
Time: 735.335 s
Ran all test suites.
error Command failed with exit code 1.
issue
code: zsh
console.warn
WARNING aws-cdk-lib.aws_ec2.MachineImage#latestAmazonLinux is deprecated. use MachineImage.latestAmazonLinux2 instead
This API will be removed in the next major release.
84790 | throw new DeprecationError(message);
84791 | case "warn":
84792 | console.warn("WARNING", message); | ^
84793 | break;
84794 | }
84795 | }
issue
code: vpn.ts
/**
* Dummy member
*/
When an enum has only one option, TypeScript handles it in a special way
and tries very hard to hide the enum declaration in favor of the sole
member. This caused incorrect type names and kinds to be emitted in the
JSII assembly, resulting in incorrect behavior.
issue
Examples:
integ.destinations.ts
integ.put-events.ts <- not found