View a markdown version of this page

Test della configurazione con Amazon EC2 - Console di gestione AWS

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Test della configurazione con Amazon EC2

Questa configurazione dimostra una connessione Console di gestione AWS Private Access ad Amazon Simple Storage Service da un'istanza Amazon EC2. L'esempio utilizza CloudFormation per creare la configurazione di rete e si connette all'istanza Windows di Amazon EC2 tramite Fleet Manager (una funzionalità diAWS Systems Manager) utilizzando il Remote Desktop Protocol (RDP).

Il diagramma seguente descrive il flusso di lavoro per l'utilizzo di Amazon EC2 per accedere a una configurazione di Accesso privato alla Console di gestione AWS. Mostra come un utente è connesso ad Amazon S3 mediante un endpoint privato.

La configurazione di configurazione per provare Console di gestione AWS Private Access utilizzando Amazon EC2.

Copia il seguente CloudFormation modello e salvalo in un file che utilizzerai nella fase tre della procedura Per configurare una rete.

Description: | AWS Management Console Private Access. Parameters: VpcCIDR: Type: String Default: 172.16.0.0/16 Description: CIDR range for VPC PrivateSubnet1CIDR: Type: String Default: 172.16.1.0/24 Description: CIDR range for Private Subnet 1 PrivateSubnet2CIDR: Type: String Default: 172.16.2.0/24 Description: CIDR range for Private Subnet 2 Ec2KeyPair: Type: AWS::EC2::KeyPair::KeyName Description: The EC2 KeyPair to use to connect to the Windows instance LatestWindowsAmiId: Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id> Default: /aws/service/ami-windows-latest/Windows_Server-2022-English-Full-Base InstanceTypeParameter: Type: String Default: m5.large Resources: ######################### # VPC AND SUBNETS ######################### AppVPC: Type: AWS::EC2::VPC Properties: CidrBlock: !Ref VpcCIDR InstanceTenancy: default EnableDnsSupport: true EnableDnsHostnames: true PrivateSubnet1: Type: AWS::EC2::Subnet Properties: VpcId: !Ref AppVPC CidrBlock: !Ref PrivateSubnet1CIDR AvailabilityZone: Fn::Select: - 0 - Fn::GetAZs: "" PrivateSubnet2: Type: AWS::EC2::Subnet Properties: VpcId: !Ref AppVPC CidrBlock: !Ref PrivateSubnet2CIDR AvailabilityZone: Fn::Select: - 1 - Fn::GetAZs: "" ######################### # Route Tables ######################### PrivateRouteTable: Type: AWS::EC2::RouteTable Properties: VpcId: !Ref AppVPC PrivateSubnet1RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: !Ref PrivateRouteTable SubnetId: !Ref PrivateSubnet1 PrivateSubnet2RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: !Ref PrivateRouteTable SubnetId: !Ref PrivateSubnet2 ######################### # SECURITY GROUPS ######################### VPCEndpointSecurityGroup: Type: AWS::EC2::SecurityGroup Properties: GroupDescription: Allow TLS for VPC Endpoint VpcId: !Ref AppVPC SecurityGroupIngress: - IpProtocol: tcp FromPort: 443 ToPort: 443 CidrIp: !GetAtt AppVPC.CidrBlock EC2SecurityGroup: Type: AWS::EC2::SecurityGroup Properties: GroupDescription: Default EC2 Instance SG VpcId: !Ref AppVPC SecurityGroupIngress: - IpProtocol: tcp FromPort: 3389 ToPort: 3389 CidrIp: !Ref VpcCIDR ######################### # VPC ENDPOINTS ######################### VPCEndpointInterfaceSsm: Type: AWS::EC2::VPCEndpoint Properties: VpcEndpointType: Interface PrivateDnsEnabled: true SubnetIds: - !Ref PrivateSubnet1 - !Ref PrivateSubnet2 SecurityGroupIds: - !Ref VPCEndpointSecurityGroup ServiceName: !Sub com.amazonaws.${AWS::Region}.ssm VpcId: !Ref AppVPC PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: '*' Action: '*' Resource: '*' Condition: StringEquals: aws:PrincipalAccount: !Ref AWS::AccountId aws:ResourceAccount: !Ref AWS::AccountId aws:SourceVpc: !Ref AppVPC - Effect: Deny Principal: '*' Action: '*' Resource: '*' Condition: StringNotEquals: aws:PrincipalAccount: !Ref AWS::AccountId aws:ResourceAccount: !Ref AWS::AccountId aws:SourceVpc: !Ref AppVPC VPCEndpointInterfaceEc2Messages: Type: AWS::EC2::VPCEndpoint Properties: VpcEndpointType: Interface PrivateDnsEnabled: true SubnetIds: - !Ref PrivateSubnet1 - !Ref PrivateSubnet2 SecurityGroupIds: - !Ref VPCEndpointSecurityGroup ServiceName: !Sub com.amazonaws.${AWS::Region}.ec2messages VpcId: !Ref AppVPC PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: '*' Action: '*' Resource: '*' Condition: StringEquals: aws:PrincipalAccount: !Ref AWS::AccountId aws:ResourceAccount: !Ref AWS::AccountId aws:SourceVpc: !Ref AppVPC - Effect: Deny Principal: '*' Action: '*' Resource: '*' Condition: StringNotEquals: aws:PrincipalAccount: !Ref AWS::AccountId aws:ResourceAccount: !Ref AWS::AccountId aws:SourceVpc: !Ref AppVPC VPCEndpointInterfaceSsmMessages: Type: AWS::EC2::VPCEndpoint Properties: VpcEndpointType: Interface PrivateDnsEnabled: true SubnetIds: - !Ref PrivateSubnet1 - !Ref PrivateSubnet2 SecurityGroupIds: - !Ref VPCEndpointSecurityGroup ServiceName: !Sub com.amazonaws.${AWS::Region}.ssmmessages VpcId: !Ref AppVPC PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: '*' Action: '*' Resource: '*' Condition: StringEquals: aws:PrincipalAccount: !Ref AWS::AccountId aws:ResourceAccount: !Ref AWS::AccountId aws:SourceVpc: !Ref AppVPC - Effect: Deny Principal: '*' Action: '*' Resource: '*' Condition: StringNotEquals: aws:PrincipalAccount: !Ref AWS::AccountId aws:ResourceAccount: !Ref AWS::AccountId aws:SourceVpc: !Ref AppVPC VPCEndpointInterfaceSignin: Type: AWS::EC2::VPCEndpoint Properties: VpcEndpointType: Interface PrivateDnsEnabled: true SubnetIds: - !Ref PrivateSubnet1 - !Ref PrivateSubnet2 SecurityGroupIds: - !Ref VPCEndpointSecurityGroup ServiceName: !Sub com.amazonaws.${AWS::Region}.signin VpcId: !Ref AppVPC PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: '*' Action: signin:Authenticate Resource: '*' Condition: StringEquals: aws:ResourceAccount: !Ref AWS::AccountId - Effect: Allow Principal: '*' Action: - signin:AuthorizeOAuth2Access - signin:CreateOAuth2Token Resource: '*' Condition: StringEquals: aws:PrincipalAccount: !Ref AWS::AccountId VPCEndpointInterfaceConsole: Type: AWS::EC2::VPCEndpoint Properties: VpcEndpointType: Interface PrivateDnsEnabled: true SubnetIds: - !Ref PrivateSubnet1 - !Ref PrivateSubnet2 SecurityGroupIds: - !Ref VPCEndpointSecurityGroup ServiceName: !Sub com.amazonaws.${AWS::Region}.console VpcId: !Ref AppVPC PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: '*' Action: '*' Resource: '*' Condition: StringEquals: aws:PrincipalAccount: !Ref AWS::AccountId aws:ResourceAccount: !Ref AWS::AccountId aws:SourceVpc: !Ref AppVPC - Effect: Deny Principal: '*' Action: '*' Resource: '*' Condition: StringNotEquals: aws:PrincipalAccount: !Ref AWS::AccountId aws:ResourceAccount: !Ref AWS::AccountId aws:SourceVpc: !Ref AppVPC VPCEndpointInterfaceConsoleStatic: # console-static only supports the full access endpoint policy Type: AWS::EC2::VPCEndpoint Properties: VpcEndpointType: Interface PrivateDnsEnabled: true SubnetIds: - !Ref PrivateSubnet1 - !Ref PrivateSubnet2 SecurityGroupIds: - !Ref VPCEndpointSecurityGroup ServiceName: !Sub com.amazonaws.${AWS::Region}.console-static VpcId: !Ref AppVPC ######################### # EC2 INSTANCE ######################### Ec2InstanceRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow Principal: Service: - ec2.amazonaws.com Action: - sts:AssumeRole Path: / ManagedPolicyArns: - arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore Ec2InstanceProfile: Type: AWS::IAM::InstanceProfile Properties: Path: / Roles: - !Ref Ec2InstanceRole Ec2LaunchTemplate: Type: AWS::EC2::LaunchTemplate Properties: LaunchTemplateData: MetadataOptions: HttpTokens: required EC2WinInstance: Type: AWS::EC2::Instance Properties: ImageId: !Ref LatestWindowsAmiId IamInstanceProfile: !Ref Ec2InstanceProfile KeyName: !Ref Ec2KeyPair InstanceType: !Ref InstanceTypeParameter SubnetId: !Ref PrivateSubnet1 SecurityGroupIds: - !Ref EC2SecurityGroup BlockDeviceMappings: - DeviceName: /dev/sda1 Ebs: VolumeSize: 50 LaunchTemplate: LaunchTemplateId: !Ref Ec2LaunchTemplate Version: !GetAtt Ec2LaunchTemplate.LatestVersionNumber Tags: - Key: Name Value: Console VPCE test instance
Configurazione di una rete
  1. Accedere all'account di gestione dell'organizzazione e aprire la console CloudFormation.

  2. Seleziona Crea stack.

  3. Scegliere Con nuove risorse (standard). Carica il file CloudFormation modello che hai creato in precedenza e scegli Avanti.

  4. Inserire un nome per lo stack, ad esempio PrivateConsoleNetworkForS3, quindi scegliere Successivo.

  5. Per VPC e sottoreti, inserire gli intervalli IP CIDR preferiti o utilizzare i valori predefiniti forniti. Se utilizzi i valori predefiniti, verifica che non si sovrappongano alle risorse VPC esistenti nel tuo. Account AWS

  6. Per il Ec2KeyPairparametro, selezionane una tra le coppie di chiavi Amazon EC2 esistenti nel tuo account. Se non si dispone di una coppia di chiavi Amazon EC2 esistente, è necessario creane una prima di passare alla fase successiva. Per ulteriori informazioni, consulta Create a key pair using Amazon EC2 nella Amazon EC2 User Guide.

  7. Seleziona Crea stack.

  8. Dopo aver creato lo stack, scegliere la scheda Risorse per visualizzare le risorse che sono state create.

Eseguire la connessione all'istanza Amazon EC2
  1. Accedere all'account di gestione dell'organizzazione e aprire la console Amazon EC2.

  2. Nel riquadro di navigazione, scegliere Instances (Istanze).

  3. Nella pagina Istanze, seleziona l'istanza di test Console VPCE creata dal modello. CloudFormation Quindi scegliere Connetti.

    Nota

    Questo esempio utilizza Fleet Manager, una funzionalità diAWS Systems Manager Explorer, per connettersi a Windows Server. Potrebbero essere necessari alcuni minuti prima che la connessione possa essere avviata.

  4. Nella pagina Connetti all'istanza, scegliere client RDP, quindi Connettiti tramite Fleet Manager.

  5. Scegliere Desktop remoto di Fleet Manager.

  6. Per ottenere la password amministrativa per l'istanza Amazon EC2 e accedere al desktop di Windows tramite l'interfaccia Web, utilizza la chiave privata associata alla coppia di chiavi Amazon EC2 utilizzata durante CloudFormation la creazione del modello.

  7. Dall'istanza Amazon EC2 per Windows, apri il file Console di gestione AWS nel browser.

  8. Dopo aver effettuato l'accesso con AWS le tue credenziali, apri la console Amazon S3 e verifica di essere connesso Console di gestione AWS tramite Private Access.

Per testareConsole di gestione AWSConfigurazione dell'accesso privato
  1. Accedere all'account di gestione dell'organizzazione e aprire la console Amazon S3.

  2. Scegliere l'icona di blocco privato nella barra di navigazione per visualizzare l'endpoint VPC in uso. La schermata seguente mostra la posizione dell'icona di blocco privato e le informazioni sul VPC.

    La console Amazon S3 che mostra l'icona del lucchetto e le informazioni di accesso Console di gestione AWS privato.