* feat(ec2): support CreateImage from an instance
Validates the source instance exists, then registers an image the same
way RegisterImage does. Unblocks AMI-baking flows (e.g. CDK
AwsCustomResource calling ec2:CreateImage on a stack-created instance).
Fixes#1978
* fix(ec2): CreateImage reboots the source and produces a launchable AMI
Two review findings.
CreateImage ignored the default reboot. AWS reboots the source instance unless
NoReboot=true so the image is captured from a quiesced file system; the action
only checked that the instance existed. NoReboot is now parsed and the reboot
runs by default.
The resulting AMI kept nothing of what it was captured from. registerImage was
called with null architecture, root device and block device mappings, so
DescribeImages reported a generic x86_64 /dev/sda1 image with no devices, and
RunInstances on the new id fell through to the catalog default guest because a
generated ami-* is not in the catalog. The image now inherits architecture,
root device name and block device mappings from the source instance's image,
and records the launchable ancestor so RunInstances starts the same guest.
CreateImage on an instance launched from a created AMI follows the chain back.
Tests: unit coverage for the reboot default and its NoReboot opt-out, and for
chained images resolving to the catalog ancestor rather than the generated id;
integration coverage that an arm64 source yields an arm64 AMI that launches.
* fix(ec2): a capture of a catalog AMI reports its root device
CreateImage inherits the source image's block device mappings, but a catalog
entry describes only its root device name and carries no mappings, so an AMI
captured from a catalog-launched instance was registered with no devices and
DescribeImages reported none.
The root device is now rebuilt from the catalog entry, with a snapshot
registered through the existing RegisterImage path.
* fix(ec2): a capture takes its own snapshot of each device
CreateImage handed the source AMI's mappings straight to RegisterImage, so the
captured image reported the source's snapshot ids and the two images shared one
snapshot. The mappings are now copied with fresh snapshot ids, keeping the
device name, size, type and encryption.
* fix(ec2): a capture includes the volumes attached after launch
CreateImage read only the mappings of the AMI the instance was launched from, so
a data volume attached afterwards was missing from the captured image. AWS
records block device mapping information for those volumes as well.
The instance's attached volumes are now added to the capture, each with its
device name, size, type and a fresh snapshot. The root volume is skipped because
the source AMI already describes that device.
Also lists CreateImage and RegisterImage in the AMIs action table. That table is
hand-maintained because Ec2QueryHandler is a deferred handler.
* fix(ec2): a capture reports the root volume type the source actually has
The catalog-source fallback in sourceImageMappings recorded the rebuilt root
device as gp2, while RunInstances creates the source instance's root volume as
gp3. DescribeImages therefore reported a type the instance never had.
Both sites now read one DEFAULT_ROOT_VOLUME_TYPE constant, alongside the
existing DEFAULT_ROOT_VOLUME_SIZE_GIB, so the two cannot drift apart again.
* fix(ec2): keep the source on security group rules
AuthorizeSecurityGroupIngress and -Egress read only
IpPermissions.N.IpRanges.M.CidrIp, so a rule whose source is another
security group was accepted and then silently stripped: it came back with
no source at all on the authorize response, on DescribeSecurityGroups and
on DescribeSecurityGroupRules. "Allow traffic from security group X" is how
an ALB is wired to its backend tasks, so that whole class of wiring could
be created against Floci but never asserted afterwards.
Parse the source types the permission actually carries: group references,
which the EC2 Query protocol serializes under the wire name Groups rather
than the SDK-facing UserIdGroupPairs, and IPv6 ranges. A reference made by
group name resolves to its group id within the target group's VPC, since
names are unique per VPC and ReferencedSecurityGroup has no name field.
Flatten one SecurityGroupRule per source entry, each keeping its own
description, matching the AWS invariant that a rule holds exactly one
source. A permission with no source at all still yields a single sourceless
rule, as before. The reference is returned as referencedGroupInfo on
DescribeSecurityGroupRules and as UserIdGroupPairs on
DescribeSecurityGroups.
An IPv6-only TCP ingress rule now publishes its host port, which it could
not do while the ranges were dropped at the parse; Ec2PortForwardManager
already treats IPv6 ranges as a CIDR source, and group references stay
unpublished.
Revoke still matches on protocol and port range alone and ignores sources,
unchanged by this.
Closes#2190
* style(ec2): brace the conditionals in the new source parsing
AGENTS.md requires braces on every conditional. The new IPv6 and group
source loops and the group-reference resolution used the unbraced form
the surrounding parse loop happens to use.
* fix(ec2): reject prefix list names AWS reserves for its own lists
CreateManagedPrefixList accepted names beginning com.amazonaws., com.amazon. or
com.aws., which AWS refuses with InvalidParameterValue, so a customer list could
shadow a seeded gateway-endpoint one.
The trailing dot is part of each prefix. Checked against a live account:
com.amazonaws-probe and comamazonaws.probe are both accepted there, so matching
without the dot would refuse names AWS allows.
Closes#2273
* fix(ec2): apply the reserved-name rule to a prefix list rename too
ModifyManagedPrefixList persisted any nonblank name, so a list could be renamed
to com.amazonaws.us-east-1.s3 and returned alongside the seeded AWS-managed list
of that name. AWS applies the same rule to a rename, verified against a live
account, and leaves the existing name in place when it rejects one.
Create and rename now share the check.
---------
Co-authored-by: Michal Schreiber <michal.schreiber@benefitsystems.pl>
* feat(ec2): support managed prefix lists
Implement CreateManagedPrefixList, DescribeManagedPrefixLists,
GetManagedPrefixListEntries, ModifyManagedPrefixList and
DeleteManagedPrefixList.
Entries are versioned: a list starts at version 1 and every modification that
changes entries stores a new version, so GetManagedPrefixListEntries can serve
an earlier TargetVersion. Renaming or raising MaxEntries does not create a
version, CurrentVersion makes a modification conditional, and removals apply
before additions so one call can replace an entry's description.
The AWS-managed gateway-endpoint lists are now built once and served by both
DescribeManagedPrefixLists and the existing DescribePrefixLists, so the two
surfaces cannot report different CIDRs for the same list. They are read-only.
Closes#2100
* fix(ec2): validate prefix list input and keep tag copies in sync
Three defects in the managed prefix list surface:
ModifyManagedPrefixList only checked the resulting entry count against
MaxEntries, so a zero or negative MaxEntries on an empty list passed the check
and persisted an impossible capacity.
CreateTags and DeleteTags update the generic tag store and then mirror the
result onto the resource, but updateResourceTags had no arm for prefix lists,
leaving the copy on the model stale for describe responses and tag filters.
MaxEntries and TargetVersion were converted with Integer/Long.valueOf, so
malformed input escaped as an unchecked NumberFormatException and became a 500
rather than a structured EC2 client error.
* fix(ec2): reject a missing PrefixListId and infer the prefix-list tag type
A null PrefixListId reached List.of() inside describeManagedPrefixLists and
threw NullPointerException, so DeleteManagedPrefixList,
GetManagedPrefixListEntries and ModifyManagedPrefixList answered a request that
never named a list with a 500 rather than a client error. Guard the lookup and
raise MissingParameter.
inferResourceType had no pl- arm, so tags on a prefix list were stored but
reported as resourceType "unknown" and were invisible to a DescribeTags filter
on resource-type. The existing test only covered describe and tag: filters,
which is why this went unnoticed.
Also cover the accepting branch of the address-family check, which until now was
only reached by the rejecting case.
* fix(ec2): treat a blank numeric parameter as malformed rather than absent
intOrNull and longOrNull returned null for a present but blank value, which the
callers read as "parameter not supplied". For CurrentVersion that silently
downgraded a conditional ModifyManagedPrefixList to an unconditional one, so a
request that asked to be gated on a version was applied anyway. Only an absent
parameter is null now; a blank one reaches the parse and surfaces as
InvalidParameterValue.
* fix(ec2): report PrefixListVersionMismatch for a stale CurrentVersion
A conditional ModifyManagedPrefixList that loses the version check returns
PrefixListVersionMismatch on AWS, not IncorrectState; verified against a live
account, which also supplies the message. The Terraform provider keys its retry
handling on that code, so the previous one would have left a caller unable to
recognise a losing conditional update.
---------
Co-authored-by: Michal Schreiber <michal.p.schreiber@gmail.com>
Terraform calls ReplaceRoute whenever an existing route changes target, so
route tables could be created but never updated; the only workaround was
to destroy and recreate the table.
The action replaces the target of the route matching DestinationCidrBlock.
AWS takes exactly one target per call, so the target a request does not name
is cleared rather than carried over; a merge would leave a route holding two
targets at once, which AWS cannot produce.
Only GatewayId and NatGatewayId are modelled by Route, plus LocalTarget,
which needs no new field because `local` is the gateway id a route table's
built-in route already carries. The other ten AWS targets keep the
UnsupportedOperation they returned before this action existed rather than
being accepted and silently clearing the route they were meant to repoint.
Errors follow the EC2 reference: InvalidRoute.NotFound when no route matches
the destination, MissingParameter when DestinationCidrBlock is absent (an
IPv6 or prefix-list request), and InvalidParameterCombination for two
targets or none.
Closes#2087
* docs: fill supported action descriptions
* docs(elb): describe listener default rule as non-deletable, not immutable
The CreateListener row called the default rule "immutable", which contradicts
the ModifyListener row (updates default actions) and the file's own note that
the rule can be changed via ModifyListener. The rule cannot be deleted or
reprioritized, but its action is mutable, so "non-deletable" is accurate.
* feat(ec2): publish security-group TCP ingress ports on the host
For each TCP port opened to a CIDR source by an instance's security
groups, start an alpine/socat sidecar that binds an allocated host port
(default 30000-30999) and forwards to the instance container's IP, so
the app is reachable from localhost. Forwards reconcile at launch, on
authorize/revoke-security-group-ingress, and on ModifyInstanceAttribute
group reassignment (previously ignored). Mappings persist and are
restored across restarts. SSH is never re-forwarded; wide rules and
per-instance totals are capped; disable with
publish-security-group-ports=false.
* fix(ec2): drop stale port mapping when sidecar recreation fails
On restore, a failed socat recreation released the host port but left
the appPort->hostPort entry in publishedPorts, so later reconciles saw
the port as already published and never re-published it, and a later
unpublish could double-release the host port. Remove the entry and
persist on failure. Also null-guard portForwardManager.restore() for
consistency with the setPersister guard. Adds a regression test.
* fix(ec2): skip port-forward reconcile on non-running instances
A reconcile queued by authorize-security-group-ingress could run after
a concurrent stop/terminate had already cleared publishedPorts and
removed the container; it then republished via the stale bridge IP,
leaking an orphaned socat sidecar and a host port that nothing would
release. Stop/terminate flip the instance state before their async
unpublishAll, so guarding reconcileNow on the running state under the
instance lock closes every window. Adds regression tests.
- emit routeTableIdSet/subnetIdSet items as plain text (AWS SDK for Go could not
deserialize the wrapped form)
- add DescribePrefixLists returning managed S3/DynamoDB prefix lists
- honor private_dns_enabled (default true for interface endpoints)
Adds Ec2IntegrationTest coverage and documents the new actions.
Implements CreateNetworkAcl, DescribeNetworkAcls (with vpc-id / default /
association.subnet-id filters), CreateNetworkAclEntry, ReplaceNetworkAclEntry,
DeleteNetworkAclEntry, ReplaceNetworkAclAssociation, and DeleteNetworkAcl.
Every VPC is provisioned with a default NACL and each subnet is associated with
it, so aws_network_acl and aws_default_network_acl work via Terraform.
Adds Ec2IntegrationTest coverage and documents the new actions.
CHANGELOG.md was empty for the 1.1.0-1.5.2 release cycle and service docs
had drifted from code behaviour. This sweep reconciles docs against the
current codebase on upstream/main.
- Backfill CHANGELOG.md for 1.1.0 through 1.5.2 from git history
- Correct exact operation counts in docs/services/index.md: S3 (~30 -> 58),
Lambda (~25 -> 30), API Gateway v1 (~24 -> 62). Counts now come from the
actual dispatch handlers rather than @Path annotation counts.
- Rewrite README "Supported Services" table to drop per-service op counts
(they drift too fast); point readers at docs/services/index.md
- Update 24 service docs for accuracy, add "Not Implemented" sections
where relevant (s3.md, lambda.md, api-gateway.md)
- Refresh configuration and getting-started docs
- Add EventBridge Scheduler and AppConfig to mkdocs nav
- Add AppConfig / AppConfigData rows to README and services index
following the 1.5.2 upstream release