AWS CLI: How to set VPC of New Replication Instance - amazon-web-services

aws dms create-replication-instance does not get VPC as an option. When I create a new instance it does not create it in the VPC I intend to create the replication instance in.
How can I achieve that?

You need to create a subnet group first and then use that when you build your instance.
The create-replication-subnet-group derives the VPC ID from the subnets you use for input. The documentation is vague but VpcId is output from the command.
The docs for that command state:
Creates a replication subnet group given a list of the subnet IDs in a VPC.
Then use the replication-subnet-group-identifier as input for the create-replication-instance command.
References
https://docs.aws.amazon.com/cli/latest/reference/dms/

Related

Use AWS CDK to Create an RDS Instance in an ISOLATED Subnet

I'm trying to use CDK (Typescript) to create an RDS (Postgres) instance within an ISOLATED subnet. As far as I understood, the default VPC created automatically in each of my account regions only has Public Subnets.
If I then want to launch a Fargate instance on top of one of those Public Subnets, do I need to create a VPC Peering between the ISOLATED subnet and the default VPC?
Any idea how to create that using CDK?
"Any idea how to create that using CDK?" -> yes:
Use AWS CDK to provision a new VPC similar to this. As you can see, there are subnets for public, applicational and database layers;
[OPTIONAL] For a better AWS CDK project organization, you can use multiple stacks like network (VPC resources), compute (Fargate resources), and database (RDS). You can pass the vpc on network stack to compute & database stacks;
Be sure that you set vpc on the ECS cluster and at load-balanced level (if applicable) and put RDS database in the isolated/database by using vpcSubnets attribute
To sum up, one VPC. No applicational or database exposed to the public. I have a git repo in case you want to look for sample code/template
VPC peering is when you have two VPC with different CIDR ranges. You have one VPC hence no need to use VPC peering.

My VPC is greyed out when trying to create a EC2 Instance?

I am trying to create an instance into my already created VPC network. For some reason when I am in the middle of the launch, I cannot select my VPC and it only lets me select a default VPC which is not what I want.
The reason for grey-out is because the VPC is created with "dedicated" tenancy. Changing the VPC to"default" tenancy will solve the issue. Apparently, there is no option to make that change in the AWS GUI. Either you have to delete and re-create the VPC with default tenancy or modify the tenancy value using the AWS CLI.
To modify the instance tenancy attribute of a VPC using the AWS CLI
Use the modify-vpc-tenancy command to specify the ID of the VPC and instance tenancy value. The only supported value is default.
aws ec2 modify-vpc-tenancy --vpc-id vpc-1a2b3c4d --instance-tenancy default
Alright so the solution was that the AMI was not compatible with my Dedicated Tenancy on my VPC so I had to delete and redo the entire VPC as default instead of Dedicated.
You probably does not have any Subnet private or public in your VPC can you please confirm?
I want to also point out that the AZ may not have any instances of that TYPE available. This will cause the VPC to be greyed out as well. I was trying to create a t2.medium or below in us-east-1c and I was seeing my VPC greyed out until I changed to an M or T3 type.

Choose VPC when creating a DMS replication instance

When using the command
aws dms create-replication-instance
How can I force/choose the VPC that will contain the instance ?
If you want to create a DMS Replication Instance somewhere other than the default VPC and subnet, you need to first create a replication subnet group. This is created with a name and a list of one or more subnet ids (all in the same VPC).
Reference for the aws-cli call to create-replication-subnet-group: https://docs.aws.amazon.com/cli/latest/reference/dms/create-replication-subnet-group.html
You would then pass that resulting replication subnet group id to create-replication-instance command as the --replication-subnet-group-identifier option.
Reference for the the aws-cli call for create-replication-instance: https://docs.aws.amazon.com/cli/latest/reference/dms/create-replication-instance.html
The DMS Replication Instance would then be created in the VPC determined by the subnet group.
VPC is too broad. You need to specify the subnet in which you want the replication instance to be created. VPC can be derived from the subnet id.
create-replication-instance
--replication-subnet-group-identifier (string)
A subnet group to associate with the replication instance.

How to launch ECS cluster in default VPC?

Is this possible? I would like to use elasticache, which seems to only be allowed to be created in my default VPC (alternative question is: How can I launch elasticache in a custom VPC), however I can't connect to it in a separate VPC. I don't know how to configure my clusters (or launch them outside of the "Getting Started")so that I can launch them in an existing VPC that I can set.
You could just create the elasticache instance in the VPC created by the ECS cluster. Though, you'll need to create a cache subnet group first. See: ElastiCache (redis) for non default VPC

How to Resolve Incompatible Subnet Groups that AWS Generates?

I'm trying to create my first RDS Instance... I select Create a new VPC and then on the next page it tells me:
"A VPC and DB Subnet Group are required but you do not have any compatible subnet groups for your current selection."
Why is it not recognizing the subnet group that is generated with the new vpc? I'm so confused. How can I launch my database?
From the RDS console, there is an option for "Subnet Groups" on the left. You have to pick a VPC, then an existing subnet(s), before you can deploy RDS into it.